Skip to content

Commit

Permalink
add test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
jrushlow committed Feb 21, 2024
1 parent 94f7c2e commit 8482a25
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/Maker/MakeEntityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,37 @@ public function getTestDetails(): \Generator
$this->runEntityTest($runner);
}),
];

yield 'it_generates_entity_with_turbo_without_mercure' => [$this->createMakeEntityTest()
->preRun(function (MakerTestRunner $runner) {
$runner->runProcess('composer require symfony/ux-turbo');
})
->addExtraDependencies('twig')
->run(function (MakerTestRunner $runner) {
$runner->runMaker([
'User', // entity class
'n', // no broadcast
'',
]);

$this->assertFileExists($runner->getPath('src/Entity/User.php'));
}),
];

yield 'it_throws_exception_with_turbo_without_mercure' => [$this->createMakeEntityTest()
->preRun(function (MakerTestRunner $runner) {
$runner->runProcess('composer require symfony/ux-turbo');
})
->addExtraDependencies('twig')
->run(function (MakerTestRunner $runner) {
$this->expectExceptionMessage('Please run "composer require symfony/mercure". It is needed to broadcast entities.');
$runner->runMaker([
'SomeEntity', // entity class
'y', // no broadcast
'',
]);
}),
];
}

private function runEntityTest(MakerTestRunner $runner, array $data = []): void
Expand Down

0 comments on commit 8482a25

Please sign in to comment.