N98\Magento\Command\Admin\User\DeleteUserCommandTest::testMessageIsPrintedIfErrorDeleting PHP Метод

testMessageIsPrintedIfErrorDeleting() публичный Метод

    public function testMessageIsPrintedIfErrorDeleting()
    {
        $this->userModel->expects($this->once())->method('loadByUsername')->with('[email protected]')->will($this->returnValue($this->userModel));
        $this->userModel->expects($this->at(1))->method('getId')->will($this->returnValue(null));
        $this->userModel->expects($this->once())->method('load')->with('[email protected]', 'email')->will($this->returnValue($this->userModel));
        $this->userModel->expects($this->at(3))->method('getId')->will($this->returnValue(2));
        $exception = new \Exception("Error!");
        $this->userModel->expects($this->once())->method('delete')->will($this->throwException($exception));
        $application = $this->getApplication();
        $application->add($this->command);
        $command = $this->getApplication()->find('admin:user:delete');
        $commandTester = new CommandTester($command);
        $commandTester->execute(array('command' => $command->getName(), 'id' => '[email protected]', '--force' => true));
        $this->assertContains('Error!', $commandTester->getDisplay());
    }