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