.
namespace Tests\Unit;
if (!defined('INSTALLDIR')) {
define('INSTALLDIR', dirname(dirname(__DIR__)));
}
if (!defined('PUBLICDIR')) {
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
}
if (!defined('GNUSOCIAL')) {
define('GNUSOCIAL', true);
}
if (!defined('STATUSNET')) { // Compatibility
define('STATUSNET', true);
}
use PHPUnit\Framework\TestCase;
require_once INSTALLDIR . '/lib/common.php';
final class HashTagDetectionTests extends TestCase
{
/**
* @dataProvider provider
* @param $content
* @param $expected
*/
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',
'#hello people'),
array('"#hello" people',
'"#hello" people'),
array('say "#hello" people',
'say "#hello" people'),
array('say (#hello) people',
'say (#hello) people'),
array('say [#hello] people',
'say [#hello] people'),
array('say {#hello} people',
'say {#hello} people'),
array('say \'#hello\' people',
'say \'#hello\' people'),
// Unicode legit letters
array('#éclair yummy',
'#éclair yummy'),
array('#维基百科 zh.wikipedia!',
'#维基百科 zh.wikipedia!'),
array('#Россия russia',
'#Россия russia'),
// Unicode punctuators -- the ideographic "," separates the tag, just as "," does
array('#维基百科,zh.wikipedia!',
'#维基百科,zh.wikipedia!'),
array('#维基百科,zh.wikipedia!',
'#维基百科,zh.wikipedia!'),
);
}
}