mirror of
https://github.com/wallabag/wallabag.git
synced 2024-12-02 22:06:28 +00:00
5b6888b13f
non-latin chars subset.
28 lines
678 B
PHP
28 lines
678 B
PHP
<?php
|
|
|
|
namespace Tests\Wallabag\CoreBundle\Tools;
|
|
|
|
use Symfony\Component\Finder\Finder;
|
|
use Wallabag\CoreBundle\Tools\Utils;
|
|
|
|
class UtilsTest extends \PHPUnit_Framework_TestCase
|
|
{
|
|
/**
|
|
* @dataProvider examples
|
|
*/
|
|
public function testCorrectWordsCountForDifferentLanguages($text, $expectedCount)
|
|
{
|
|
static::assertEquals((float) $expectedCount, Utils::getReadingTime($text));
|
|
}
|
|
|
|
public function examples()
|
|
{
|
|
$examples = [];
|
|
$finder = (new Finder())->in(__DIR__.'/samples');
|
|
foreach ($finder->getIterator() as $file) {
|
|
$examples[] = [$file->getContents(), 1];
|
|
}
|
|
|
|
return $examples;
|
|
}
|
|
}
|