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

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

    public function testConfirmationTrueReplyDeletesUser()
    {
        $this->userModel->expects($this->once())->method('loadByUsername')->with('notauser')->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('notauser', 'email')->will($this->returnValue($this->userModel));
        $this->userModel->expects($this->at(3))->method('getId')->will($this->returnValue(2));
        $this->userModel->expects($this->once())->method('delete');
        $application = $this->getApplication();
        $application->add($this->command);
        $command = $this->getApplication()->find('admin:user:delete');
        $dialog = $this->getMock('Symfony\\Component\\Console\\Helper\\DialogHelper', array('askConfirmation'));
        $dialog->expects($this->once())->method('askConfirmation')->will($this->returnValue(true));
        // We override the standard helper with our mock
        $command->getHelperSet()->set($dialog, 'dialog');
        $commandTester = new CommandTester($command);
        $commandTester->execute(array('command' => $command->getName(), 'id' => 'notauser'));
        $this->assertContains('User was successfully deleted', $commandTester->getDisplay());
    }