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

testIfNoIdIsPresentItIsPromptedFor() public method

    public function testIfNoIdIsPresentItIsPromptedFor()
    {
        $userEmail = '[email protected]';
        $dialog = $this->getMock('Symfony\\Component\\Console\\Helper\\DialogHelper', array('ask'));
        $dialog->expects($this->once())->method('ask')->will($this->returnValue($userEmail));
        $this->userModel->expects($this->once())->method('loadByUsername')->with($userEmail)->will($this->returnValue($this->userModel));
        $this->userModel->method('getId')->will($this->returnValue(2));
        $this->userModel->method('getUsername')->will($this->returnValue('aydin'));
        $application = $this->getApplication();
        $application->add($this->command);
        $command = $this->getApplication()->find($this->commandName);
        // We override the standard helper with our mock
        $command->getHelperSet()->set($dialog, 'dialog');
        $commandTester = new CommandTester($command);
        $commandTester->execute(array('command' => $command->getName()));
        $this->assertContains("User aydin is now inactive", $commandTester->getDisplay());
    }