.
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/util/common.php';
final class HashTagDetectionTests extends TestCase
{
/**
* @dataProvider provider
*
* @param $content
* @param $expected
*/
public function testProduction($content, $expected)
{
$rendered = common_render_text($content);
static::assertSame($expected, $rendered);
}
public static function provider()
{
return [
['hello',
'hello',],
['#hello people',
'#hello people',],
['"#hello" people',
'"#hello" people',],
['say "#hello" people',
'say "#hello" people',],
['say (#hello) people',
'say (#hello) people',],
['say [#hello] people',
'say [#hello] people',],
['say {#hello} people',
'say {#hello} people',],
['say \'#hello\' people',
'say \'#hello\' people',],
// Unicode legit letters
['#éclair yummy',
'#éclair yummy',],
['#维基百科 zh.wikipedia!',
'#维基百科 zh.wikipedia!',],
['#Россия russia',
'#Россия russia',],
// Unicode punctuators -- the ideographic "," separates the tag, just as "," does
['#维基百科,zh.wikipedia!',
'#维基百科,zh.wikipedia!',],
['#维基百科,zh.wikipedia!',
'#维基百科,zh.wikipedia!',],
];
}
}