From ff3ce788b0ec63303e21c56f35b64e61016abb1d Mon Sep 17 00:00:00 2001 From: vpaladiychuk <vpaladiychuk@ebay.com> Date: Sun, 15 Mar 2015 18:24:51 +0200 Subject: [PATCH] MAGETWO-34878: PR and cleanup --- .../Model/Template/Filter/FactoryTest.php | 10 +++++++++ .../Controller/Onepage/SaveBillingTest.php | 12 +++++++++++ .../Block/Adminhtml/Block/Edit/FormTest.php | 11 +++++++++- .../Order/Creditmemo/AddCommentTest.php | 15 +++++++++++++ .../Model/PageLayout/Config/BuilderTest.php | 6 ++++++ .../Framework/Test/Unit/PhraseTest.php | 21 +++++++++++++++++++ 6 files changed, 74 insertions(+), 1 deletion(-) mode change 100644 => 100755 app/code/Magento/Checkout/Test/Unit/Controller/Onepage/SaveBillingTest.php mode change 100644 => 100755 app/code/Magento/Sales/Test/Unit/Controller/Adminhtml/Order/Creditmemo/AddCommentTest.php mode change 100644 => 100755 app/code/Magento/Theme/Test/Unit/Model/PageLayout/Config/BuilderTest.php diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Template/Filter/FactoryTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Template/Filter/FactoryTest.php index 7259e897171..93c3afc25a7 100755 --- a/app/code/Magento/Catalog/Test/Unit/Model/Template/Filter/FactoryTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Template/Filter/FactoryTest.php @@ -17,6 +17,9 @@ class FactoryTest extends \PHPUnit_Framework_TestCase */ protected $_factory; + /** + * Setup + */ protected function setUp() { $this->_objectManagerMock = $this->getMock('Magento\Framework\ObjectManagerInterface'); @@ -28,6 +31,9 @@ class FactoryTest extends \PHPUnit_Framework_TestCase ); } + /** + * Test create + */ public function testCreate() { $className = 'Magento\Framework\Filter\Template'; @@ -47,6 +53,9 @@ class FactoryTest extends \PHPUnit_Framework_TestCase $this->assertEquals($filterMock, $this->_factory->create($className)); } + /** + * Test create with arguments + */ public function testCreateWithArguments() { $className = 'Magento\Framework\Filter\Template'; @@ -70,6 +79,7 @@ class FactoryTest extends \PHPUnit_Framework_TestCase /** * @expectedException \Magento\Framework\Exception\LocalizedException * @expectedExceptionMessage WrongClass doesn't extend \Magento\Framework\Filter\Template + * @return void */ public function testWrongTypeException() { diff --git a/app/code/Magento/Checkout/Test/Unit/Controller/Onepage/SaveBillingTest.php b/app/code/Magento/Checkout/Test/Unit/Controller/Onepage/SaveBillingTest.php old mode 100644 new mode 100755 index 996d6fe2ad2..790eee760fe --- a/app/code/Magento/Checkout/Test/Unit/Controller/Onepage/SaveBillingTest.php +++ b/app/code/Magento/Checkout/Test/Unit/Controller/Onepage/SaveBillingTest.php @@ -79,6 +79,9 @@ class SaveBillingTest extends \PHPUnit_Framework_TestCase */ protected $resultJson; + /** + * Setup + */ protected function setUp() { $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); @@ -165,6 +168,9 @@ class SaveBillingTest extends \PHPUnit_Framework_TestCase ); } + /** + * Test execute + */ public function testExecute() { $this->request->expects($this->once()) @@ -181,6 +187,9 @@ class SaveBillingTest extends \PHPUnit_Framework_TestCase $this->assertSame($this->resultRaw, $this->controller->execute()); } + /** + * Test validate minimum amount + */ public function testValidateMinimumAmount() { $expectedResult = [ @@ -253,6 +262,9 @@ class SaveBillingTest extends \PHPUnit_Framework_TestCase $this->assertSame($this->resultJson, $this->controller->execute()); } + /** + * Test validate minimum amount negative + */ public function testValidateMinimumAmountNegative() { $errorMessage = 'error_message'; diff --git a/app/code/Magento/Cms/Test/Unit/Block/Adminhtml/Block/Edit/FormTest.php b/app/code/Magento/Cms/Test/Unit/Block/Adminhtml/Block/Edit/FormTest.php index 562d395c90e..731904fba69 100755 --- a/app/code/Magento/Cms/Test/Unit/Block/Adminhtml/Block/Edit/FormTest.php +++ b/app/code/Magento/Cms/Test/Unit/Block/Adminhtml/Block/Edit/FormTest.php @@ -130,6 +130,10 @@ class FormTest extends \PHPUnit_Framework_TestCase */ protected $block; + /** + * Sets up the fixture, for example, open a network connection. + * This method is called before a test is executed. + */ public function setUp() { $this->model = $this->getMock('Magento\Cms\Model\Block', ['getBlockId', 'setStoreId'], [], '', false); @@ -207,6 +211,9 @@ class FormTest extends \PHPUnit_Framework_TestCase $this->block->setData('action', $this->action); } + /** + * Test prepare form model has no block id and single store mode is on + */ public function testPrepareFormModelHasNoBlockIdAndSingleStoreMode() { $blockId = null; @@ -232,7 +239,9 @@ class FormTest extends \PHPUnit_Framework_TestCase $this->block->toHtml(); } - + /** + * Test prepare form model has block id and signle store mode is off + */ public function testPrepareFormModelHasBlockIdAndNonSingleStoreMode() { $blockId = 'id'; diff --git a/app/code/Magento/Sales/Test/Unit/Controller/Adminhtml/Order/Creditmemo/AddCommentTest.php b/app/code/Magento/Sales/Test/Unit/Controller/Adminhtml/Order/Creditmemo/AddCommentTest.php old mode 100644 new mode 100755 index d4dd0c0c6dc..3154697b999 --- a/app/code/Magento/Sales/Test/Unit/Controller/Adminhtml/Order/Creditmemo/AddCommentTest.php +++ b/app/code/Magento/Sales/Test/Unit/Controller/Adminhtml/Order/Creditmemo/AddCommentTest.php @@ -75,6 +75,9 @@ class AddCommentTest extends \PHPUnit_Framework_TestCase */ protected $resultRawMock; + /** + * Setup + */ public function setUp() { $titleMock = $this->getMockBuilder('Magento\Framework\App\Action\Title') @@ -144,6 +147,9 @@ class AddCommentTest extends \PHPUnit_Framework_TestCase ); } + /** + * Test execute module exception + */ public function testExecuteModelException() { $message = 'Model exception'; @@ -167,6 +173,9 @@ class AddCommentTest extends \PHPUnit_Framework_TestCase ); } + /** + * Test execute exception + */ public function testExecuteException() { $message = 'Cannot add new comment.'; @@ -190,6 +199,9 @@ class AddCommentTest extends \PHPUnit_Framework_TestCase ); } + /** + * Test execute no comment + */ public function testExecuteNoComment() { $message = 'The Comment Text field cannot be empty.'; @@ -214,6 +226,9 @@ class AddCommentTest extends \PHPUnit_Framework_TestCase ); } + /** + * Test execute + */ public function testExecute() { $comment = 'Test comment'; diff --git a/app/code/Magento/Theme/Test/Unit/Model/PageLayout/Config/BuilderTest.php b/app/code/Magento/Theme/Test/Unit/Model/PageLayout/Config/BuilderTest.php old mode 100644 new mode 100755 index 9b7008531a3..d81cdb4843b --- a/app/code/Magento/Theme/Test/Unit/Model/PageLayout/Config/BuilderTest.php +++ b/app/code/Magento/Theme/Test/Unit/Model/PageLayout/Config/BuilderTest.php @@ -31,6 +31,9 @@ class BuilderTest extends \PHPUnit_Framework_TestCase */ protected $themeCollection; + /** + * Setup + */ protected function setUp() { $this->configFactory = $this->getMockBuilder('Magento\Framework\View\PageLayout\ConfigFactory') @@ -61,6 +64,9 @@ class BuilderTest extends \PHPUnit_Framework_TestCase ); } + /** + * Test get page layouts config + */ public function testGetPageLayoutsConfig() { $files1 = ['content layouts_1.xml', 'content layouts_2.xml']; diff --git a/lib/internal/Magento/Framework/Test/Unit/PhraseTest.php b/lib/internal/Magento/Framework/Test/Unit/PhraseTest.php index 5925acd955f..4976a670caa 100755 --- a/lib/internal/Magento/Framework/Test/Unit/PhraseTest.php +++ b/lib/internal/Magento/Framework/Test/Unit/PhraseTest.php @@ -19,6 +19,9 @@ class PhraseTest extends \PHPUnit_Framework_TestCase */ protected $rendererMock; + /** + * Set up + */ protected function setUp() { $this->defaultRenderer = Phrase::getRenderer(); @@ -26,11 +29,17 @@ class PhraseTest extends \PHPUnit_Framework_TestCase ->getMock(); } + /** + * Tear down + */ protected function tearDown() { Phrase::setRenderer($this->defaultRenderer); } + /** + * Test rendering + */ public function testRendering() { $text = 'some text'; @@ -47,6 +56,9 @@ class PhraseTest extends \PHPUnit_Framework_TestCase $this->assertEquals($result, $phrase->render()); } + /** + * Test defers rendering + */ public function testDefersRendering() { $this->rendererMock->expects($this->never()) @@ -55,6 +67,9 @@ class PhraseTest extends \PHPUnit_Framework_TestCase new Phrase('some text'); } + /** + * Test that to string is alias to render + */ public function testThatToStringIsAliasToRender() { $text = 'some text'; @@ -71,6 +86,9 @@ class PhraseTest extends \PHPUnit_Framework_TestCase $this->assertEquals($result, (string)$phrase); } + /** + * Test get text + */ public function testGetText() { $text = 'some text'; @@ -79,6 +97,9 @@ class PhraseTest extends \PHPUnit_Framework_TestCase $this->assertEquals($text, $phrase->getText()); } + /** + * Test get arguments + */ public function testGetArguments() { $text = 'some text'; -- GitLab