aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag/CoreBundle/Tools/UtilsTest.php
diff options
context:
space:
mode:
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}