aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag/CoreBundle/Tools/UtilsTest.php
diff options
context:
space:
mode:
authorAndrew Kovalyov <andrew.kovalyoff@gmail.com>2016-11-28 01:15:06 +0200
committerAndrew Kovalyov <andrew.kovalyoff@gmail.com>2016-11-28 01:15:06 +0200
commit5b6888b13fd44705a232261862a5cc96cebd0a7d (patch)
treee3d5a370d5f50d75e1a7f6ffe59462d05976ec94 /tests/Wallabag/CoreBundle/Tools/UtilsTest.php
parent625bb561813222aea8a7a2e84e30e9f9de697017 (diff)
downloadwallabag-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.php28
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
3namespace Tests\Wallabag\CoreBundle\Tools;
4
5use Symfony\Component\Finder\Finder;
6use Wallabag\CoreBundle\Tools\Utils;
7
8class 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}