b2pweb /
bdf-prime-bundle
| 1 | <?php |
||||
| 2 | |||||
| 3 | namespace Bdf\PrimeBundle\Tests; |
||||
| 4 | |||||
| 5 | require_once __DIR__.'/TestKernel.php'; |
||||
| 6 | |||||
| 7 | use Bdf\Prime\Shell\PrimeShellCommand; |
||||
| 8 | use Bdf\PrimeBundle\PrimeBundle; |
||||
| 9 | use PHPUnit\Framework\TestCase; |
||||
| 10 | use Symfony\Bundle\FrameworkBundle\Console\Application; |
||||
| 11 | use Symfony\Bundle\FrameworkBundle\FrameworkBundle; |
||||
| 12 | use Symfony\Component\Config\Loader\LoaderInterface; |
||||
| 13 | use Symfony\Component\Console\Command\LazyCommand; |
||||
| 14 | use Symfony\Component\DependencyInjection\ContainerBuilder; |
||||
| 15 | use Symfony\Component\HttpKernel\Kernel; |
||||
| 16 | |||||
| 17 | class WithPrimeShellTest extends TestCase |
||||
| 18 | { |
||||
| 19 | private $kernel; |
||||
| 20 | |||||
| 21 | protected function setUp(): void |
||||
| 22 | { |
||||
| 23 | if (!class_exists(PrimeShellCommand::class)) { |
||||
| 24 | $this->markTestSkipped('PrimeShell not installed'); |
||||
| 25 | } |
||||
| 26 | |||||
| 27 | $this->kernel = new class('test', true) extends Kernel { |
||||
| 28 | use \Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; |
||||
| 29 | |||||
| 30 | public function registerBundles(): iterable |
||||
| 31 | { |
||||
| 32 | return [ |
||||
| 33 | new FrameworkBundle(), |
||||
| 34 | new PrimeBundle(), |
||||
| 35 | ]; |
||||
| 36 | } |
||||
| 37 | |||||
| 38 | protected function configureContainer(ContainerBuilder $c, LoaderInterface $loader) |
||||
|
0 ignored issues
–
show
|
|||||
| 39 | { |
||||
| 40 | $loader->import(__DIR__.'/Fixtures/config.yaml'); |
||||
| 41 | } |
||||
| 42 | |||||
| 43 | protected function configureRoutes($routes) |
||||
|
0 ignored issues
–
show
The parameter
$routes is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. Loading history...
|
|||||
| 44 | { |
||||
| 45 | } |
||||
| 46 | }; |
||||
| 47 | $this->kernel->boot(); |
||||
| 48 | } |
||||
| 49 | |||||
| 50 | public function testCommands() |
||||
| 51 | { |
||||
| 52 | $app = new Application($this->kernel); |
||||
| 53 | |||||
| 54 | $command = $app->get('prime:shell'); |
||||
| 55 | |||||
| 56 | if ($command instanceof LazyCommand) { |
||||
| 57 | $command = $command->getCommand(); |
||||
| 58 | } |
||||
| 59 | |||||
| 60 | $this->assertInstanceOf(PrimeShellCommand::class, $command); |
||||
| 61 | } |
||||
| 62 | } |
||||
| 63 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.