public function testArgumentPromptsWhenNotPresent()
{
$dialog = $this->getMock('Symfony\\Component\\Console\\Helper\\DialogHelper', array('ask', 'askHiddenResponse'));
$dialog->expects($this->at(0))->method('ask')->will($this->returnValue('aydin'));
$dialog->expects($this->at(1))->method('ask')->will($this->returnValue('[email protected]'));
$dialog->expects($this->at(2))->method('askHiddenResponse')->will($this->returnValue('p4ssw0rd'));
$dialog->expects($this->at(3))->method('ask')->will($this->returnValue('Aydin'));
$dialog->expects($this->at(4))->method('ask')->will($this->returnValue('Hassan'));
$this->roleModel->expects($this->once())->method('load')->with('Administrators', 'role_name')->will($this->returnValue($this->roleModel));
$this->roleModel->method('getId')->will($this->returnValue(9));
$this->userModel->expects($this->at(0))->method('setData')->with(array('username' => 'aydin', 'firstname' => 'Aydin', 'lastname' => 'Hassan', 'email' => '[email protected]', 'password' => 'p4ssw0rd', 'is_active' => 1))->will($this->returnValue($this->userModel));
$this->userModel->expects($this->once())->method('save')->will($this->returnValue($this->userModel));
$this->userModel->expects($this->once(2))->method('setRoleIds')->with(array(9))->will($this->returnValue($this->userModel));
$this->userModel->expects($this->at(3))->method('getUserId')->will($this->returnValue(2));
$this->userModel->expects($this->once())->method('setRoleUserId')->with(2)->will($this->returnValue($this->userModel));
$this->userModel->expects($this->once())->method('saveRelations');
$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(), 'role' => 'Administrators'));
$this->assertContains('User aydin successfully created', $commandTester->getDisplay());
}