N98\Magento\Command\Admin\User\ChangeStatusCommandTest::testCanEnableByUser PHP Метод

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

public testCanEnableByUser ( )
    public function testCanEnableByUser()
    {
        $username = 'aydin';
        $this->userModel->expects($this->once())->method('loadByUsername')->with($username)->will($this->returnValue($this->userModel));
        $this->userModel->expects($this->at(1))->method('getId')->will($this->returnValue(2));
        $this->userModel->expects($this->at(2))->method('getId')->will($this->returnValue(2));
        $this->userModel->expects($this->once())->method('validate');
        $this->userModel->expects($this->at(4))->method('getIsActive')->will($this->returnValue(0));
        $this->userModel->expects($this->once())->method('setIsActive')->with(1);
        $this->userModel->expects($this->once())->method('save');
        $this->userModel->expects($this->at(7))->method('getIsActive')->will($this->returnValue(1));
        $this->userModel->expects($this->once())->method('getUsername')->will($this->returnValue($username));
        $application = $this->getApplication();
        $application->add($this->command);
        $command = $this->getApplication()->find($this->commandName);
        $commandTester = new CommandTester($command);
        $commandTester->execute(array('command' => $command->getName(), 'id' => $username));
        $this->assertContains("User {$username} is now active", $commandTester->getDisplay());
    }