diff --git a/README.md b/README.md index f06afdb0..9e3bbaec 100644 --- a/README.md +++ b/README.md @@ -5,112 +5,92 @@ Exercism exercises in PHP Follow these instructions to contribute to the PHP track. To solve the exercises, head to the [PHP track][exercism-track-home] and check the [documentation][exercism-track-installation]. -## Quick Start with Dev Containers +## Quick Start -This repo includes a [dev container](.devcontainer) that provides PHP 8.4, Composer, `jq` and all other dependencies out of the box. -Open the repo in [VS Code][vscode-devcontainers] (or [GitHub Codespaces][github-codespaces]) and select "Reopen in Container" - `composer install` runs automatically once it starts. +### Dev containers -## Install Dependencies +This repo includes a [dev container](.devcontainer) that provides PHP 8.4, `composer`, `jq` and all other dependencies out of the box. +Open the repo in [VS Code][vscode-devcontainers] (or [GitHub Codespaces][github-codespaces]) and select "Reopen in Container". -The following system dependencies are required: +### Local -- `composer`, as recommended in the [PHP track installation docs][exercism-track-installation-composer]. -- [`bash` shell][gnu-bash]. -- PHP V8.4+ CLI, with the following extensions: - - `ds` (V1.x) - - `intl` - - Default modules: `Core`, `ctype`, `date`, `dom`, `fileinfo`, `filter`, `hash`, `iconv`, `json`, `libxml`, `mbstring`, `pcre`, `random`, `Reflection`, `SimpleXML`, `sodium`, `SPL`, `standard`, `tokenizer`, `xml`, `xmlreader`, `xmlwriter`, `zlib` -- An active Internet connection for installing required tools / composer packages. -- [`jq`][jq], if you change the difficulty or add a practice exercise. +For a non-devcontainer setup, see `.devcontainer/` for exact setup. -The [dev container](.devcontainer) already provides all of the above. - -Run the following command to get started with this project: +In particular the required dependencies are: `bash`, `jq`, `php8.4`, `composer`, `ext-gmp`, `ext-ds` (v1.x), `ext-intl`. +Install composer dependencies with: ```shell -composer install # Required dependencies to develop this track +~/> composer install +contribution/> composer install ``` -## Running Exercism resources management - -`bin/configlet` is the official tool for managing Exercism language track repositories. -See [Building Exercism docs][exercism-configlet]. - -For convenience, you can use `composer configlet:fmt` to fix formatting issues in the Exercism track files. -This is included in `composer ci` to run the CI checks locally. - -## Running Unit Test Suite - -The tests are run with PHPUnit. A shell loop injecting `exemplar.php` is provided to ease testing. +## PHP track maintenance -Execute the following command to run the tests: +[`bin/configlet`][exercism-configlet] is the official tool for managing Exercism language track repositories. -```shell -composer test:run -``` - -This is included in `composer ci` to run the CI checks locally. +### Running Unit Test Suite -### Run a specific test - -If you want to run tests for one specific exercise, you can do it with following cli command. +The tests are run with PHPUnit. Execute the following command to run the tests: ```shell -composer test:run -- exercise-name -# e.g -composer test:run -- book-store +~/> composer tests:run # Runs whole test suite +~/> composer tests:run -- # Runs tests for (e.g. book-store) +~/> composer tests:run -- "b*" # Runs tests for starting with `b` ``` -If you want to run all starting with let's say 'b' you can run +### Code style -```shell -composer test:run -- "b*" -``` +[`bin/configlet fmt`][exercism-configlet-fmt] checks Exercism's ressources files (json). -## Running Style Checker +`composer lint:check` checks PHP files using a slightly [modified][local-file-phpcs-config] version of [PSR-12]. -This project uses a slightly [modified][local-file-phpcs-config] version of [PSR-12]. -Use the following commands to apply code style: +Autofix (for both Exercism and PHP files) is provided with `composer format:fix`. -```shell -composer lint:check # Checks the files against the code style rules -composer lint:fix # Automatically fix code style issues -``` +### Continuous Integration -The `lint:check` is included in `composer ci` to run the CI checks locally. +`composer ci` invokes the above checks: [code style][h-code-style], [tests][h-unit-tests]. ## Contributing - Read the documentation at [Exercism][exercism-docs]. -- Follow the [PSR-12] coding style (Exercisms PHP track uses a slightly [modified][local-file-phpcs-config] version of [PSR-12]). +- Follow the [PSR-12] coding style (Exercism's PHP track uses a slightly [modified][local-file-phpcs-config] version of [PSR-12]). - Run `composer ci` to run CI checks locally before pushing. -- CI is run on all pull requests, it must pass the required checks for merge. -- CI is running all tests on PHP 8.1 to PHP 8.4 for Linux, Windows and MacOS. +- CI runs on all pull requests, it must pass the required checks for merge. +- CI runs all tests on PHP 8.2 to PHP 8.4 for Linux, Windows and MacOS. +- [Contribution tools](./contribution/README.md) are available. + +### Generating new practice exercises + +Adding a new exercise involves multiple steps -## Generating new practice exercises +#### 1. Initialize exercism resources Use `bin/configlet create --practice-exercise ` to create the exercism resources required. This provides you with the directories and files in `exercises/practice/`. Look into `tests.toml` for which test cases **not** to implement / generate and mark them with `include = false`. -Test generator MVP used like this: +#### 2. Write tests -```shell -composer -d contribution/generator install -contribution/generator/bin/console app:create-tests '' -composer lint:fix -``` +Once the directory structure is created either: +1. Use `php contribution/main.php exercism:test:bootstrap ` to init a test file with tests bodies to implement. +2. Create a `Test.php.twig` file and run `php contribution/main.php exercism:test:generate ` to render the corresponding `Test.php` file. + +A `.meta/example.php` file is also necessary in order to validate that the implementation is correct / achievable. + +#### 3. Miscellaneous Run `bin/order-exercises.sh` when you set the exercise difficulty to a sensible value to order the exercises on the website accordingly. +Ensures that the [test suite runs][h-unit-tests] and that the files are properly [formatted][h-code-style]. + [exercism-configlet]: https://exercism.org/docs/building/configlet +[exercism-configlet-fmt]: https://exercism.org/docs/building/configlet/format [exercism-docs]: https://exercism.org/docs [exercism-track-home]: https://exercism.org/docs/tracks/php [exercism-track-installation]: https://exercism.org/docs/tracks/php/installation -[exercism-track-installation-composer]: https://exercism.org/docs/tracks/php/installation#h-install-composer [github-codespaces]: https://docs.github.com/en/codespaces/overview -[gnu-bash]: https://www.gnu.org/software/bash/ -[jq]: https://jqlang.org/ [local-file-phpcs-config]: phpcs.xml [psr-12]: https://www.php-fig.org/psr/psr-12 [vscode-devcontainers]: https://code.visualstudio.com/docs/devcontainers/containers +[h-code-style]: #code-style +[h-unit-tests]: #running-unit-test-suite diff --git a/composer.json b/composer.json index ba07902f..d363c2c7 100644 --- a/composer.json +++ b/composer.json @@ -36,7 +36,7 @@ ], "format:fix": [ "@lint:fix", - "@configlet:fmt" + "@configlet:fmt --update --yes" ], "lint:check": "phpcs", "lint:fix": "phpcbf", diff --git a/contribution/README.md b/contribution/README.md index 3af5e9d2..126e46eb 100644 --- a/contribution/README.md +++ b/contribution/README.md @@ -1,32 +1,19 @@ Commands to automate some contribution part of `exercism/php`. -They are all invokable with `php main.php `. +They are all invokable with `php main.php `. ## `exercism:deprecated` -checks upstream deprecated exercises +Lists upstream-deprecated exercises that are not track-deprecated yet. -## `exercism:create-tests` +Those exercises should be flagged with `"status": "deprecated"` in the PHP track. -This is a small poc on how we could auto generate tests for the PHP track based on the https://github.com/exercism/problem-specifications/. +## `exercism:test:bootstrap` -How to test it: +Bootstrap an `Test.php` file for argument ``. -``` -git clone https://github.com/tomasnorre/exercism-tests-generation.git -cd exercism-tests-generation -composer install -php main.php exercism:create-tests nucleotide-count -vendor/bin/phpunit src/Command/NucleotideCountTest.php -``` +Tests functions have to be implemented manually afterward. -If you now make a `git status` you will see that the `src/Command/NucleotideCountTest.php` and you can now inspect the auto generated tests. +## `exercism:test:generate` -It's all based on the `nikic/php-parser` and the https://github.com/exercism/problem-specifications/ repository, I have made a local copy of that on file -for now to spare the http-requests. - -Let me know what you think. - -## `exercism:generate-tests` - -Generate tests from a twig template file +Generate `Test.php` files from `Test.php.twig` files for argument ``. diff --git a/contribution/main.php b/contribution/main.php index 1b3058b2..a7aa05e1 100644 --- a/contribution/main.php +++ b/contribution/main.php @@ -5,25 +5,24 @@ require_once __DIR__ . '/vendor/autoload.php'; -use App\Command\CreateTestsCommand; use App\Command\Deprecated; -use App\Command\GenerateTests; -use App\Configlet; +use App\Command\TestGenerate; +use App\Command\TestBootstrap; +use App\Service\Configlet; use League\Flysystem\Filesystem; use League\Flysystem\Local\LocalFilesystemAdapter; use Symfony\Component\Console\Application; use Symfony\Component\HttpClient\HttpClient; $application = new Application(); +$repositoryRoot = __DIR__ . '/../'; +$configlet = new Configlet($repositoryRoot . '/bin/configlet', $repositoryRoot); +$exercises = new Filesystem(new LocalFilesystemAdapter($repositoryRoot . '/exercises')); -$exercises = new LocalFilesystemAdapter(__DIR__ . '/../exercises'); $application->addCommand( - new Deprecated( - new Filesystem($exercises), - HttpClient::createForBaseUri('https://github.com/exercism/problem-specifications'), - ), + new Deprecated($exercises, HttpClient::createForBaseUri('https://github.com/exercism/problem-specifications')), ); -$application->addCommand(new CreateTestsCommand(__DIR__ . '/..')); -$application->addCommand(new GenerateTests(new Configlet(__DIR__ . '/../bin/configlet'), new Filesystem($exercises))); +$application->addCommand(new TestBootstrap($configlet, $exercises)); +$application->addCommand(new TestGenerate($configlet, $exercises)); $application->run(); diff --git a/contribution/src/Command/CreateTestsCommand.php b/contribution/src/Command/CreateTestsCommand.php deleted file mode 100644 index 590796c6..00000000 --- a/contribution/src/Command/CreateTestsCommand.php +++ /dev/null @@ -1,62 +0,0 @@ -trackRoot, $exerciseSlug); - $testGenerator = new TestGenerator(); - - $io = new SymfonyStyle($input, $output); - $io->writeln('Generating tests for ' . $exerciseSlug . ' in ' . $exercise->pathToExercise()); - - $written = \file_put_contents( - // TODO(@mk-mxp): Make '$exercise->pathToTestFile()' - $exercise->pathToExercise() . '/' . $this->inPascalCase($exerciseSlug) . 'Test.php', - $testGenerator->createTestsFor($exercise->canonicalData(), $this->inPascalCase($exerciseSlug)), - ); - if ($written === false) { - throw new RuntimeException( - 'Cannot write exercise as ' - . $exercise->pathToExercise() - . '. Create exercise with `bin/configlet create --practice-exercise ` first or check access rights.', - ); - } - // TODO(@mk-mxp): Make '$exercise->pathToStudentsFile()' - // TODO(@mk-mxp): Make '$testGenerator->studentsFileFor()' - - $io->success('Generating Tests - Finished'); - return Command::SUCCESS; - } - - private function inPascalCase(string $text): string - { - return \str_replace(' ', '', \ucwords(\str_replace('-', ' ', $text))); - } -} diff --git a/contribution/src/Command/Deprecated.php b/contribution/src/Command/Deprecated.php index f6adfcb3..afe02bba 100644 --- a/contribution/src/Command/Deprecated.php +++ b/contribution/src/Command/Deprecated.php @@ -21,7 +21,7 @@ use const JSON_THROW_ON_ERROR; -#[AsCommand('exercism:deprecated', 'This command allows you to check for deprecated exercises...')] +#[AsCommand('exercism:deprecated', 'Lists upstream-deprecated exercises that are not track-deprecated yet.')] readonly class Deprecated { public function __construct( diff --git a/contribution/src/Command/TestBootstrap.php b/contribution/src/Command/TestBootstrap.php new file mode 100644 index 00000000..19f88049 --- /dev/null +++ b/contribution/src/Command/TestBootstrap.php @@ -0,0 +1,153 @@ +configlet->canonicalData($exerciseSlug); + $exercisePath = PathResolver::exercisePath('practice', $exerciseSlug); + + $io = new SymfonyStyle($input, $output); + $io->writeln('Generating tests for ' . $exerciseSlug . ' in ' . $exercisePath); + + $this->exercisesFilesystem->write( + // TODO(@mk-mxp): Make '$exercise->pathToTestFile()' + $exercisePath . '/' . $this->inPascalCase($exerciseSlug) . 'Test.php', + $this->createTestsFor($canonicalData, $this->inPascalCase($exerciseSlug)), + ); + // TODO(@mk-mxp): Make '$exercise->pathToStudentsFile()' + // TODO(@mk-mxp): Make '$testGenerator->studentsFileFor()' + + $io->success('Generating Tests - Finished'); + return Command::SUCCESS; + } + + private function inPascalCase(string $text): string + { + return \str_replace(' ', '', \ucwords(\str_replace('-', ' ', $text))); + } + + private function createTestsFor(CanonicalData $canonicalData, string $exerciseClass): string + { + $builderFactory = new BuilderFactory(); + + $class = $builderFactory + ->class($exerciseClass . 'Test') + ->makeFinal() + ->extend('TestCase'); + $class->setDocComment("/**\n * " . implode("\n * ", $canonicalData->comments) . "\n */"); + + // Include Setup Method + $methodSetup = 'setUpBeforeClass'; + $method = $builderFactory + ->method($methodSetup) + ->makePublic() + ->makeStatic() + ->setReturnType('void') + ->addStmt($builderFactory->funcCall('require_once', [$exerciseClass . '.php'])); + + $class->addStmt($method); + + $this->addCases($class, $builderFactory, $canonicalData->cases); + + $namespace = new Node\Stmt\Namespace_(new Node\Name('Tests')); + $namespace->stmts[] = $builderFactory->use(TestCase::class)->getNode(); + $namespace->stmts[] = $class->getNode(); + + $printer = new PrettyPrinter\Standard(); + + return $printer->prettyPrintFile([$namespace]) . "\n"; + } + + /** + * @param list $cases + * @return void + */ + private function addCases(Class_ $class, BuilderFactory $builderFactory, array $cases): void + { + foreach ($cases as $case) { + if ($case instanceof LabeledTestGroup) { + $this->addCases($class, $builderFactory, $case->cases); + + continue; + } + + assert($case instanceof LabeledTest, '$case is always a LabeledTest here.'); + // Generate a method for each test case + $description = \ucfirst($case->description); + $methodName = ucfirst(str_replace('-', ' ', $description)); + $methodName = 'test' . str_replace(' ', '', ucwords($methodName)); + + // $exceptionClassName = new Node\Name\FullyQualified('Exception'); + $method = $builderFactory + ->method($methodName) + ->makePublic() + ->setReturnType('void') + ->setDocComment("/** uuid: {$case->uuid} */") + ->addAttribute(new Node\Attribute( + new Node\Name(\PHPUnit\Framework\Attributes\TestDox::class), + [new Node\Arg(new Node\Scalar\String_($description))], + )) + ->addStmt($builderFactory->funcCall('$this->markTestIncomplete', [ + 'This test has not been implemented yet.', + ])); + // if (isset($case->expected->error)) { + // $method->addStmt( + // $builderFactory->funcCall('$this->expectException', + // [new Node\Arg(new Node\Expr\ClassConstFetch($exceptionClassName, 'class'))] + // ) + // ) + // ->addStmt($builderFactory->funcCall($case->property, [$case->input->strand ?? 'unknown'])) + // ; + // } else { + // $method->addStmt( + // $builderFactory->funcCall('$this->assertEquals', [ + // $case->expected, + // $builderFactory->funcCall($case->property, [$case->input->strand ?? 'unknown']) + // ]) + // ); + // } + + $class->addStmt($method); + } + } +} diff --git a/contribution/src/Command/GenerateTests.php b/contribution/src/Command/TestGenerate.php similarity index 94% rename from contribution/src/Command/GenerateTests.php rename to contribution/src/Command/TestGenerate.php index f45a7595..1223be7a 100644 --- a/contribution/src/Command/GenerateTests.php +++ b/contribution/src/Command/TestGenerate.php @@ -4,11 +4,12 @@ namespace App\Command; -use App\Configlet; use App\Model\CanonicalData\CanonicalData; use App\Model\CanonicalData\LabeledTest; use App\Model\CanonicalData\LabeledTestGroup; use App\Model\CanonicalData\LabeledTestItem; +use App\Service\Configlet; +use App\Service\PathResolver; use Brick\VarExporter\VarExporter; use InvalidArgumentException; use JsonException; @@ -40,8 +41,8 @@ use const JSON_THROW_ON_ERROR; -#[AsCommand('exercism:generate-tests', 'Exercism PHP Test Generator')] -class GenerateTests +#[AsCommand('exercism:test:generate', 'Generates Test.php files from Test.php.twig templates.')] +class TestGenerate { public function __construct( private Configlet $configlet, @@ -49,6 +50,8 @@ public function __construct( ) {} /** + * @param 'practice'|'concept' $category + * * @throws TwigError * @throws ParseException * @throws FilesystemException @@ -66,8 +69,9 @@ public function __invoke( ): int { $logger = new ConsoleLogger($output); $canonicalData = $this->configlet->canonicalData($exerciseSlug); + $exercisePath = PathResolver::exercisePath($category, $exerciseSlug); - $success = $this->generate($category . '/' . $exerciseSlug, $check, $canonicalData, $logger); + $success = $this->generate($exercisePath, $check, $canonicalData, $logger); return $success ? Command::SUCCESS : Command::FAILURE; } diff --git a/contribution/src/Configlet.php b/contribution/src/Service/Configlet.php similarity index 96% rename from contribution/src/Configlet.php rename to contribution/src/Service/Configlet.php index afbb3e06..7d8707e0 100644 --- a/contribution/src/Configlet.php +++ b/contribution/src/Service/Configlet.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App; +namespace App\Service; use App\Model\CanonicalData\CanonicalData; use RuntimeException; @@ -13,6 +13,7 @@ final class Configlet { public function __construct( private string $configletPath, + private string $repositoryRoot, ) {} /** @@ -34,7 +35,7 @@ private function cacheDirectory(): string 'detailed', 'info', '--offline', - ], __DIR__ . '/../../'); + ], $this->repositoryRoot); try { $configlet->mustRun(); } catch (ProcessRuntimeException $exception) { diff --git a/contribution/src/Service/PathResolver.php b/contribution/src/Service/PathResolver.php new file mode 100644 index 00000000..1df25f40 --- /dev/null +++ b/contribution/src/Service/PathResolver.php @@ -0,0 +1,18 @@ +builderFactory = new BuilderFactory(); - - $class = $this->builderFactory - ->class($exerciseClass . 'Test') - ->makeFinal() - ->extend('TestCase'); - $class->setDocComment("/**\n * " . implode("\n * ", $canonicalData->comments) . "\n */"); - - // Include Setup Method - $methodSetup = 'setUpBeforeClass'; - $method = $this->builderFactory - ->method($methodSetup) - ->makePublic() - ->makeStatic() - ->setReturnType('void') - ->addStmt($this->builderFactory->funcCall('require_once', [$exerciseClass . '.php'])); - - $class->addStmt($method); - - foreach ($canonicalData->testCases as $case) { - // Generate a method for each test case - $description = \ucfirst($case->description); - $methodName = ucfirst(str_replace('-', ' ', $description)); - $methodName = 'test' . str_replace(' ', '', ucwords($methodName)); - - // $exceptionClassName = new Node\Name\FullyQualified('Exception'); - $method = $this->builderFactory - ->method($methodName) - ->makePublic() - ->setReturnType('void') - ->setDocComment("/** uuid: {$case->uuid} */") - ->addAttribute(new Node\Attribute( - new Node\Name(\PHPUnit\Framework\Attributes\TestDox::class), - [new Node\Arg(new Node\Scalar\String_($description))], - )) - ->addStmt($this->builderFactory->funcCall('$this->markTestIncomplete', [ - 'This test has not been implemented yet.', - ])); - // if (isset($case->expected->error)) { - // $method->addStmt( - // $this->builderFactory->funcCall('$this->expectException', - // [new Node\Arg(new Node\Expr\ClassConstFetch($exceptionClassName, 'class'))] - // ) - // ) - // ->addStmt($this->builderFactory->funcCall($case->property, [$case->input->strand ?? 'unknown'])) - // ; - // } else { - // $method->addStmt( - // $this->builderFactory->funcCall('$this->assertEquals', [ - // $case->expected, - // $this->builderFactory->funcCall($case->property, [$case->input->strand ?? 'unknown']) - // ]) - // ); - // } - - $class->addStmt($method); - } - - $namespace = new Namespace_(new Node\Name('Tests')); - $namespace->stmts[] = $this->builderFactory->use(TestCase::class)->getNode(); - $namespace->stmts[] = $class->getNode(); - - $printer = new PrettyPrinter\Standard(); - - return $printer->prettyPrintFile([$namespace]) . PHP_EOL; - } -} diff --git a/contribution/src/TrackData/CanonicalData.php b/contribution/src/TrackData/CanonicalData.php deleted file mode 100644 index 1b53aff8..00000000 --- a/contribution/src/TrackData/CanonicalData.php +++ /dev/null @@ -1,20 +0,0 @@ - $comments - * - * @mago-expect lint:excessive-parameter-list - */ - public function __construct( - public string $uuid, - public string $description, - public string $property, - public mixed $input, - public mixed $expected, - public array $comments = [], - ) {} -} diff --git a/contribution/src/TrackData/Exercise.php b/contribution/src/TrackData/Exercise.php deleted file mode 100644 index 59e472b1..00000000 --- a/contribution/src/TrackData/Exercise.php +++ /dev/null @@ -1,20 +0,0 @@ -configlet = new Configlet($trackRoot . '/bin/configlet'); - $this->pathToPracticeExercises = $trackRoot . '/exercises/practice/'; - $this->pathToExercise = $this->pathToPracticeExercises . $this->exerciseSlug; - } - - #[\Override] - public function pathToExercise(): string - { - return $this->pathToExercise; - } - - /** - * @throws RuntimeException - */ - #[\Override] - public function canonicalData(): CanonicalData - { - // https://github.com/exercism/problem-specifications?tab=readme-ov-file#test-data-format - /** @var array{exercise: string, comments?: list, cases: list}>} $canonicalData */ - $canonicalData = \json_decode( - $this->configlet->canonicalDataRaw($this->exerciseSlug), - true, - flags: JSON_THROW_ON_ERROR, - ); - - // TODO(@homersimpsons): Handle recursive cases - return new CanonicalData( - $canonicalData['exercise'], - array_map( - static fn($case) => new TestCase( - $case['uuid'], - $case['description'], - $case['property'], - $case['input'], - $case['expected'], - $case['comments'] ?? [], - ), - $canonicalData['cases'], - ), - $canonicalData['comments'] ?? [], - ); - } -} diff --git a/contribution/tests/GenerateTestsTest.php b/contribution/tests/TestGenerateTest.php similarity index 89% rename from contribution/tests/GenerateTestsTest.php rename to contribution/tests/TestGenerateTest.php index f49ced8d..53941a49 100644 --- a/contribution/tests/GenerateTestsTest.php +++ b/contribution/tests/TestGenerateTest.php @@ -4,10 +4,10 @@ namespace App\Tests; -use App\Command\GenerateTests; -use App\Configlet; +use App\Command\TestGenerate; use App\Model\CanonicalData\CanonicalData; use App\Model\CanonicalData\LabeledTest; +use App\Service\Configlet; use League\Flysystem\Filesystem; use League\Flysystem\FilesystemException; use League\Flysystem\InMemory\InMemoryFilesystemAdapter; @@ -16,7 +16,7 @@ use Psr\Log\NullLogger; use Twig\Error\Error as TwigError; -class GenerateTestsTest extends TestCase +class TestGenerateTest extends TestCase { /** * @throws FilesystemException @@ -38,7 +38,7 @@ public function testGenerate(): void new LabeledTest('uuid', 'this-Is_a test fn', 'prop', ['a' => [1, 2]], null), ]); - $application = new GenerateTests(new Configlet('/tmp'), $exerciseFs); + $application = new TestGenerate(new Configlet('/tmp', '/tmp'), $exerciseFs); $success = $application->generate($basePath, false, $canonicalData, new NullLogger()); static::assertTrue($success);