diff options
author | Jeremy Benoist <j0k3r@users.noreply.github.com> | 2017-01-27 09:34:32 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-27 09:34:32 +0100 |
commit | 6fb06904ecde15b1b07d0a2af945338b416cf0e2 (patch) | |
tree | e76f3e8142399316ec5660fab8c646b2c34b8336 /tests/Wallabag/CoreBundle/Tools/UtilsTest.php | |
parent | 05fa529bcfde01be5d320cb532900d72cf4b0830 (diff) | |
parent | 78295b99dd1721c613f1ce52e2debbe6f6db7753 (diff) | |
download | wallabag-6fb06904ecde15b1b07d0a2af945338b416cf0e2.tar.gz wallabag-6fb06904ecde15b1b07d0a2af945338b416cf0e2.tar.zst wallabag-6fb06904ecde15b1b07d0a2af945338b416cf0e2.zip |
Merge pull request #2416 from wallabag/2.2
wallabag 2.2.0
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 | } | ||