diff options
author | Andrew Kovalyov <andrew.kovalyoff@gmail.com> | 2016-11-28 01:15:06 +0200 |
---|---|---|
committer | Andrew Kovalyov <andrew.kovalyoff@gmail.com> | 2016-11-28 01:15:06 +0200 |
commit | 5b6888b13fd44705a232261862a5cc96cebd0a7d (patch) | |
tree | e3d5a370d5f50d75e1a7f6ffe59462d05976ec94 /tests/Wallabag/CoreBundle/Tools/UtilsTest.php | |
parent | 625bb561813222aea8a7a2e84e30e9f9de697017 (diff) | |
download | wallabag-5b6888b13fd44705a232261862a5cc96cebd0a7d.tar.gz wallabag-5b6888b13fd44705a232261862a5cc96cebd0a7d.tar.zst wallabag-5b6888b13fd44705a232261862a5cc96cebd0a7d.zip |
Fix incorrect reading time calculation for entries in languages with
non-latin chars subset.
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 | } | ||