]>
Commit | Line | Data |
---|---|---|
5b6888b1 AK |
1 | <?php |
2 | ||
3 | namespace Tests\Wallabag\CoreBundle\Tools; | |
4 | ||
5 | use Symfony\Component\Finder\Finder; | |
6 | use Wallabag\CoreBundle\Tools\Utils; | |
7 | ||
8 | class UtilsTest extends \PHPUnit_Framework_TestCase | |
9 | { | |
10 | /** | |
11 | * @dataProvider examples | |
12 | */ | |
13 | public function testCorrectWordsCountForDifferentLanguages($text, $expectedCount) | |
14 | { | |
15 | static::assertEquals((float) $expectedCount, Utils::getReadingTime($text)); | |
16 | } | |
17 | ||
18 | public function examples() | |
19 | { | |
20 | $examples = []; | |
f808b016 | 21 | $finder = (new Finder())->in(__DIR__ . '/samples'); |
5b6888b1 AK |
22 | foreach ($finder->getIterator() as $file) { |
23 | $examples[] = [$file->getContents(), 1]; | |
24 | } | |
25 | ||
26 | return $examples; | |
27 | } | |
28 | } |