assertInstanceOf(KernelInterface::class, self::$kernel); $this->userRepository = $container->get(UserRepository::class); $application = new Application(self::$kernel); $command = $application->find('tvdt:make-admin'); $this->commandTester = new CommandTester($command); } public function testMakeAdmin(): void { $this->commandTester->execute([ 'email' => 'test@example.org', ]); $user = $this->userRepository->findOneBy(['email' => 'test@example.org']); $this->assertInstanceOf(User::class, $user); $this->assertSame(Command::SUCCESS, $this->commandTester->getStatusCode()); $this->assertContains('ROLE_ADMIN', $user->roles); } public function testInvalidEmailFails(): void { $this->commandTester->execute([ 'email' => 'nonexisting@example.org', ]); $this->assertSame(Command::FAILURE, $this->commandTester->getStatusCode()); } }