N98\Magento\Command\Customer\CreateCommandTest::testExecute PHP Метод

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

public testExecute ( )
    public function testExecute()
    {
        $command = $this->_getCommand();
        $generatedEmail = uniqid() . '@example.com';
        $this->getApplication()->initMagento();
        $website = \Mage::app()->getWebsite();
        $commandTester = new CommandTester($command);
        $options = array('command' => $command->getName(), 'email' => $generatedEmail, 'password' => 'password123', 'firstname' => 'John', 'lastname' => 'Doe', 'website' => $website->getCode());
        $commandTester->execute($options);
        $this->assertRegExp('/Customer ' . $generatedEmail . ' successfully created/', $commandTester->getDisplay());
        // Format option
        $commandTester = new CommandTester($command);
        $generatedEmail = uniqid() . '@example.com';
        $options['email'] = $generatedEmail;
        $options['--format'] = 'csv';
        $this->assertEquals(0, $commandTester->execute($options));
        $this->assertContains('email,password,firstname,lastname', $commandTester->getDisplay());
        $this->assertContains($generatedEmail . ',password123,John,Doe', $commandTester->getDisplay());
    }