diff --git a/app/config.php b/app/config.php index 2c5fb252..17d0ffbb 100644 --- a/app/config.php +++ b/app/config.php @@ -1,5 +1,7 @@ withInsertion(new Insertion(Insertion::TYPE_BEFORE, 'ini_set("display_errors", 1);')) ->withInsertion(new Insertion(Insertion::TYPE_BEFORE, 'error_reporting(E_ALL);')) ->withInsertion(new Insertion(Insertion ::TYPE_BEFORE, 'date_default_timezone_set("Europe/London");')); - + return new CodePatcher($c->get(Parser::class), new Standard, $patch); }, FakerGenerator::class => function () { return FakerFactory::create(); }, RequestRenderer::class => create(), - + Terminal::class => factory([TerminalFactory::class, 'fromSystem']), 'menu' => factory(MenuFactory::class), MenuFactory::class => create(), diff --git a/src/Application.php b/src/Application.php index 11ef2b29..4fd93ab8 100644 --- a/src/Application.php +++ b/src/Application.php @@ -1,5 +1,7 @@ output->writeLine($this->color->__invoke('Usage')->yellow()->bold()); + $this->output->writeLine((string) $this->color->__invoke('Usage')->yellow()->bold()); $this->output->writeLine(""); $this->output->writeLine(sprintf(" %s", $this->color->__invoke($this->appName)->green())); $this->output->writeLine(" Show a menu to interactively select a workshop."); @@ -57,7 +59,7 @@ public function __invoke(): void $this->output->writeLine(" Show the people who made this happen."); $this->output->writeLine(""); $this->output->writeLine( - $this->color->__invoke('Having trouble with a PHPSchool exercise?')->yellow()->bold() + (string) $this->color->__invoke('Having trouble with a PHPSchool exercise?')->yellow()->bold() ); $this->output->writeLine(""); $this->output->writeLine(" A team of expert helper elves is eagerly waiting to assist you in"); @@ -72,7 +74,7 @@ public function __invoke(): void $this->output->writeLine(" https://chat.stackoverflow.com/rooms/11/php"); $this->output->writeLine(""); $this->output->writeLine( - $this->color->__invoke('Found a bug with PHPSchool or just want to contribute?')->yellow()->bold() + (string) $this->color->__invoke('Found a bug with PHPSchool or just want to contribute?')->yellow()->bold() ); $this->output->writeLine(" The official repository for PHPSchool is:"); $this->output->writeLine(" https://github.com/php-school/php-workshop"); diff --git a/src/Command/MenuCommand.php b/src/Command/MenuCommand.php index b925c912..58b58394 100644 --- a/src/Command/MenuCommand.php +++ b/src/Command/MenuCommand.php @@ -1,5 +1,7 @@ setAccessible(true); - $refProp->setValue($this->check, null); + $refProp->setValue($this->check, 'notvaliddsn'); try { $this->check->attach($eventDispatcher); diff --git a/test/CommandRouterTest.php b/test/CommandRouterTest.php index a1b18bc2..2629c02c 100644 --- a/test/CommandRouterTest.php +++ b/test/CommandRouterTest.php @@ -49,7 +49,7 @@ public function testRouteCommandWithNoArgsFromArrayUsesDefaultCommand(): void $mock->expects($this->once()) ->method('__invoke') - ->willReturn(true); + ->willReturn(1); $c = $this->createMock(ContainerInterface::class); $eventDispatcher = $this->createMock(EventDispatcher::class); @@ -68,7 +68,7 @@ public function testRouteCommandWithNoArgsFromArgVUsesDefaultCommand(): void $mock->expects($this->once()) ->method('__invoke') - ->willReturn(true); + ->willReturn(1); $c = $this->createMock(ContainerInterface::class); $eventDispatcher = $this->createMock(EventDispatcher::class); @@ -138,7 +138,7 @@ public function testRouteCommandWithArgs(): void && $input->getArgument('exercise') === 'some-exercise' && $input->getArgument('program') === 'program.php'; })) - ->willReturn(true); + ->willReturn(1); $c = $this->createMock(ContainerInterface::class); $eventDispatcher = $this->createMock(EventDispatcher::class); @@ -234,7 +234,7 @@ public function testCallableFromContainer(): void && $input->getArgument('exercise') === 'some-exercise' && $input->getArgument('program') === 'program.php'; })) - ->willReturn(true); + ->willReturn(1); $c ->expects($this->once()) @@ -313,7 +313,7 @@ public function testRouteCommandSpeltIncorrectlyStillRoutes(): void && $input->getArgument('exercise') === 'some-exercise' && $input->getArgument('program') === 'program.php'; })) - ->willReturn(true); + ->willReturn(1); $c = $this->createMock(ContainerInterface::class); $eventDispatcher = $this->createMock(EventDispatcher::class); @@ -358,7 +358,7 @@ public function testRouteCommandWithOptionalArgument(): void }) ] ) - ->willReturnOnConsecutiveCalls(true, true); + ->willReturnOnConsecutiveCalls(1, null, 1); $c = $this->createMock(ContainerInterface::class); $eventDispatcher = $this->createMock(EventDispatcher::class);