From bc46e4fa6bcf0e9ae2fcd97a803bd79e620c5aa7 Mon Sep 17 00:00:00 2001 From: Ivan Gavryshko <igavryshko@ebay.com> Date: Mon, 11 May 2015 09:28:13 -0500 Subject: [PATCH] MAGETWO-36070: Move dev/tools/performance-toolkit/generate.php - added command test --- .../Command/GenerateFixturesCommand.php | 2 +- .../Command/GenerateFixturesCommandTest.php | 46 +++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 setup/src/Magento/Setup/Test/Unit/Console/Command/GenerateFixturesCommandTest.php diff --git a/setup/src/Magento/Setup/Console/Command/GenerateFixturesCommand.php b/setup/src/Magento/Setup/Console/Command/GenerateFixturesCommand.php index 3f20ef0693b..2e5e5493d8f 100644 --- a/setup/src/Magento/Setup/Console/Command/GenerateFixturesCommand.php +++ b/setup/src/Magento/Setup/Console/Command/GenerateFixturesCommand.php @@ -23,7 +23,7 @@ class GenerateFixturesCommand extends Command const PROFILE_ARGUMENT = 'profile'; /** - * @var Application + * @var FixtureModel */ private $application; diff --git a/setup/src/Magento/Setup/Test/Unit/Console/Command/GenerateFixturesCommandTest.php b/setup/src/Magento/Setup/Test/Unit/Console/Command/GenerateFixturesCommandTest.php new file mode 100644 index 00000000000..2fbec156092 --- /dev/null +++ b/setup/src/Magento/Setup/Test/Unit/Console/Command/GenerateFixturesCommandTest.php @@ -0,0 +1,46 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Setup\Test\Unit\Console\Command; + +use Magento\Setup\Fixtures\FixtureModel; +use Magento\Setup\Console\Command\GenerateFixturesCommand; +use Symfony\Component\Console\Tester\CommandTester; + +class GenerateFixturesCommandTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var FixtureModel|\PHPUnit_Framework_MockObject_MockObject + */ + private $fixtureModel; + + public function setUp() + { + $this->fixtureModel = $this->getMock('Magento\Setup\Fixtures\FixtureModel', [], [], '', false); + $this->command = new GenerateFixturesCommand($this->fixtureModel); + } + + public function testExecute() + { + $this->fixtureModel->expects($this->once())->method('loadConfig')->with('path_to_profile.xml'); + $this->fixtureModel->expects($this->once())->method('initObjectManager'); + $this->fixtureModel->expects($this->once())->method('loadFixtures'); + + $commandTester = new CommandTester($this->command); + $commandTester->execute(['profile' => 'path_to_profile.xml']); + } + + /** + * @expectedException \RuntimeException + * @expectedExceptionMessage Not enough arguments. + */ + public function testExecuteInvalidLanguageArgument() + { + + $commandTester = new CommandTester($this->command); + $commandTester->execute([]); + } +} -- GitLab