diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-11-28 09:23:04 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-28 09:23:04 +0100 |
commit | 6bb0866cf513bf939eb2e3290d1852c55e51ec0d (patch) | |
tree | ce69e28c3cce2f562005d8ba7c357fb69647807d /tests/Wallabag/CoreBundle/Tools/UtilsTest.php | |
parent | 5b644798a09f87e07dde95a85ab283affd7b3659 (diff) | |
parent | 5b6888b13fd44705a232261862a5cc96cebd0a7d (diff) | |
download | wallabag-6bb0866cf513bf939eb2e3290d1852c55e51ec0d.tar.gz wallabag-6bb0866cf513bf939eb2e3290d1852c55e51ec0d.tar.zst wallabag-6bb0866cf513bf939eb2e3290d1852c55e51ec0d.zip |
Merge pull request #2659 from akovalyov/bugfix/non-latin-characters-in-reading-time-calculation
Fix incorrect reading time calculation for entries in non-latin languages.
Diffstat (limited to 'tests/Wallabag/CoreBundle/Tools/UtilsTest.php')
-rw-r--r-- | tests/Wallabag/CoreBundle/Tools/UtilsTest.php | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/Wallabag/CoreBundle/Tools/UtilsTest.php b/tests/Wallabag/CoreBundle/Tools/UtilsTest.php new file mode 100644 index 00000000..435c25ca --- /dev/null +++ b/tests/Wallabag/CoreBundle/Tools/UtilsTest.php | |||
@@ -0,0 +1,28 @@ | |||
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 = []; | ||
21 | $finder = (new Finder())->in(__DIR__.'/samples'); | ||
22 | foreach ($finder->getIterator() as $file) { | ||
23 | $examples[] = [$file->getContents(), 1]; | ||
24 | } | ||
25 | |||
26 | return $examples; | ||
27 | } | ||
28 | } | ||