diff options
author | Evan Prodromou <evan@controlyourself.ca> | 2009-08-27 07:56:19 -0700 |
---|---|---|
committer | Evan Prodromou <evan@controlyourself.ca> | 2009-08-27 07:56:19 -0700 |
commit | f1fda6c0503e32edfc99b297f4bf2cb07e629d9e (patch) | |
tree | 4190903afb80c20b7e98c95e6ea8d57ced0695d9 /tests/HashTagDetectionTest.php | |
parent | 209486d3be877d85b3e241797e6042283d0f66d6 (diff) | |
parent | fd53fba114283935a304ed2e05111da256ae798f (diff) |
Merge branch '0.8.x' into 0.9.x
Diffstat (limited to 'tests/HashTagDetectionTest.php')
-rw-r--r-- | tests/HashTagDetectionTest.php | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/HashTagDetectionTest.php b/tests/HashTagDetectionTest.php new file mode 100644 index 000000000..901e0611c --- /dev/null +++ b/tests/HashTagDetectionTest.php @@ -0,0 +1,47 @@ +<?php + +if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) { + print "This script must be run from the command line\n"; + exit(); +} + +define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); +define('LACONICA', true); + +require_once INSTALLDIR . '/lib/common.php'; + +class HashTagDetectionTest extends PHPUnit_Framework_TestCase +{ + /** + * @dataProvider provider + * + */ + public function testProduction($content, $expected) + { + $rendered = common_render_text($content); + $this->assertEquals($expected, $rendered); + } + + static public function provider() + { + return array( + array('hello', + 'hello'), + array('#hello people', + '#<span class="tag"><a href="' . common_local_url('tag', array('tag' => common_canonical_tag('hello'))) . '" rel="tag">hello</a></span> people'), + array('"#hello" people', + '"#<span class="tag"><a href="' . common_local_url('tag', array('tag' => common_canonical_tag('hello'))) . '" rel="tag">hello</a></span>" people'), + array('say "#hello" people', + 'say "#<span class="tag"><a href="' . common_local_url('tag', array('tag' => common_canonical_tag('hello'))) . '" rel="tag">hello</a></span>" people'), + array('say (#hello) people', + 'say (#<span class="tag"><a href="' . common_local_url('tag', array('tag' => common_canonical_tag('hello'))) . '" rel="tag">hello</a></span>) people'), + array('say [#hello] people', + 'say [#<span class="tag"><a href="' . common_local_url('tag', array('tag' => common_canonical_tag('hello'))) . '" rel="tag">hello</a></span>] people'), + array('say {#hello} people', + 'say {#<span class="tag"><a href="' . common_local_url('tag', array('tag' => common_canonical_tag('hello'))) . '" rel="tag">hello</a></span>} people'), + array('say \'#hello\' people', + 'say \'#<span class="tag"><a href="' . common_local_url('tag', array('tag' => common_canonical_tag('hello'))) . '" rel="tag">hello</a></span>\' people'), + ); + } +} + |