N98\Magento\Command\Admin\User\DeleteUserCommandTest::testIfNoIdIsPresentItIsPromptedFor PHP Method

testIfNoIdIsPresentItIsPromptedFor() public method

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