Move to Symfony Flex

The structure changed completely.
Bundles are gone. Everything is flatten in the folder `src`.
I separated import & api controllers to avoid _pollution_ in the main controller folder.
This commit is contained in:
Jeremy Benoist
2022-12-20 22:36:02 +01:00
parent 911e0238b7
commit 6b5a518ce2
629 changed files with 7238 additions and 2194 deletions

39
tests/Tools/UtilsTest.php Normal file
View File

@ -0,0 +1,39 @@
<?php
namespace App\Tests\Tools;
use App\Tools\Utils;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Finder\Finder;
class UtilsTest extends TestCase
{
/**
* @dataProvider examples
*/
public function testCorrectWordsCountForDifferentLanguages($filename, $text, $expectedCount)
{
static::assertSame((float) $expectedCount, Utils::getReadingTime($text), 'Reading time for: ' . $filename);
}
public function examples()
{
$examples = [];
$finder = (new Finder())->in(__DIR__ . '/samples');
foreach ($finder->getIterator() as $file) {
preg_match('/-----CONTENT-----\s*(.*?)\s*-----READING_TIME-----\s*(.*)/sx', $file->getContents(), $match);
if (3 !== \count($match)) {
throw new \Exception('Sample file "' . $file->getRelativePathname() . '" as wrong definition, see README.');
}
$examples[] = [
$file->getRelativePathname(),
$match[1], // content
$match[2], // reading time
];
}
return $examples;
}
}