Skip to content

Commit cdcc72a

Browse files
committed
MAGETWO-31059: Integration tests with fatals, code under test and framework adaptation
- necessary changes after sync with mainline, cleanup
1 parent ebc3c56 commit cdcc72a

File tree

11 files changed

+20
-29
lines changed

11 files changed

+20
-29
lines changed

.htaccess

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,6 @@
170170

171171
</IfModule>
172172

173-
<IfModule mod_env.c>
174-
SetEnv MAGE_MODE "developer"
175-
</IfModule>
176-
177173
############################################
178174
## By default allow all access
179175

app/code/Magento/Bundle/Test/Unit/Model/Product/Attribute/Source/Price/ViewTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function testGetOptionTextForExistLabel()
7474
{
7575
$existValue = 1;
7676

77-
$this->assertInternalType('string', $this->model->getOptionText($existValue));
77+
$this->assertInstanceOf('Magento\Framework\Phrase', $this->model->getOptionText($existValue));
7878
}
7979

8080
/**

app/code/Magento/Cms/Test/Unit/Block/Adminhtml/Block/EditTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ protected function setUp()
5353
'Magento\Cms\Block\Adminhtml\Block\Edit',
5454
[
5555
'registry' => $this->registryMock,
56-
'escaper' => $this->escaperMock
56+
'escaper' => $this->escaperMock,
5757
]
5858
);
5959
}
@@ -84,14 +84,14 @@ public function testGetHeaderText($modelBlockId)
8484
->with($title)
8585
->willReturn($escapedTitle);
8686

87-
$this->assertInternalType('string', $this->this->getHeaderText());
87+
$this->assertInstanceOf('Magento\Framework\Phrase', $this->this->getHeaderText());
8888
}
8989

9090
public function getHeaderTextDataProvider()
9191
{
9292
return [
9393
'modelBlockId NOT EMPTY' => ['modelBlockId' => 1],
94-
'modelBlockId IS EMPTY' => ['modelBlockId' => null]
94+
'modelBlockId IS EMPTY' => ['modelBlockId' => null],
9595
];
9696
}
9797
}

app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,7 @@ protected function _prepareProduct(\Magento\Framework\Object $buyRequest, $produ
779779
}
780780

781781
if (!isset($_result[0])) {
782-
return __('Cannot add the item to shopping cart');
782+
return __('Cannot add the item to shopping cart')->render();
783783
}
784784

785785
/**

app/code/Magento/Customer/Test/Unit/Controller/Account/ConfirmTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ protected function setUp()
171171
'customerRepository' => $this->customerRepositoryMock,
172172
'addressHelper' => $this->addressHelperMock,
173173
'urlFactory' => $urlFactoryMock,
174-
'resultRedirectFactory' => $redirectFactoryMock
174+
'resultRedirectFactory' => $redirectFactoryMock,
175175
]
176176
);
177177
}
@@ -388,12 +388,12 @@ public function testSuccessRedirect(
388388
->with($this->equalTo('*/*/index'), ['_secure' => true])
389389
->will($this->returnValue($successUrl));
390390

391-
$this->redirectMock->expects($this->once())
391+
$this->redirectMock->expects($this->never())
392392
->method('success')
393393
->with($this->equalTo($resultUrl))
394394
->will($this->returnValue($resultUrl));
395395

396-
$this->scopeConfigMock->expects($this->once())
396+
$this->scopeConfigMock->expects($this->never())
397397
->method('isSetFlag')
398398
->with(
399399
$this->equalTo(Url::XML_PATH_CUSTOMER_STARTUP_REDIRECT_TO_DASHBOARD),
@@ -426,7 +426,7 @@ public function getSuccessRedirectDataProvider()
426426
'http://example.com/success',
427427
'http://example.com/success',
428428
true,
429-
__('Thank you for registering with')
429+
__('Thank you for registering with'),
430430
],
431431
[
432432
1,
@@ -435,7 +435,7 @@ public function getSuccessRedirectDataProvider()
435435
'http://example.com/success',
436436
'http://example.com/success',
437437
false,
438-
__('Thank you for registering with')
438+
__('Thank you for registering with'),
439439
],
440440
];
441441
}

app/code/Magento/Downloadable/Model/Product/Type.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ protected function _prepareProduct(\Magento\Framework\Object $buyRequest, $produ
482482
return $result;
483483
}
484484
if ($this->getLinkSelectionRequired($product) && $this->_isStrictProcessMode($processMode)) {
485-
return __('Please specify product link(s).');
485+
return __('Please specify product link(s).')->render();
486486
}
487487
return $result;
488488
}

app/code/Magento/GroupedProduct/Model/Product/Type/Grouped.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ public function getStatusFilters($product)
262262
if (!$product->hasData($this->_keyStatusFilters)) {
263263
return [
264264
\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED,
265-
\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_DISABLED
265+
\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_DISABLED,
266266
];
267267
}
268268
return $product->getData($this->_keyStatusFilters);
@@ -361,7 +361,7 @@ protected function _prepareProduct(\Magento\Framework\Object $buyRequest, $produ
361361
}
362362

363363
if (!isset($_result[0])) {
364-
return __('We cannot process the item.');
364+
return __('We cannot process the item.')->render();
365365
}
366366

367367
if ($isStrictProcessMode) {
@@ -399,7 +399,7 @@ protected function _prepareProduct(\Magento\Framework\Object $buyRequest, $produ
399399
}
400400
}
401401

402-
return __('Please specify the quantity of product(s).');
402+
return __('Please specify the quantity of product(s).')->render();
403403
}
404404

405405
/**

app/functions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ function __()
1818
$argc = $argc[0];
1919
}
2020

21-
return (new \Magento\Framework\Phrase($text, $argc))->render();
21+
return new \Magento\Framework\Phrase($text, $argc);
2222
}

dev/tests/static/testsuite/Magento/Test/HhvmCompatibility/IniGetSetTest.php renamed to dev/tests/static/testsuite/Magento/Test/Integrity/HhvmCompatibilityTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
* See COPYING.txt for license details.
77
*
88
*/
9-
namespace Magento\Test\HhvmCompatibility;
9+
namespace Magento\Test\Integrity;
1010

11-
use Magento\Framework\Test\Utility\Files;
11+
use Magento\Framework\App\Utility\Files;
1212

13-
class IniGetSetTest extends \PHPUnit_Framework_TestCase
13+
class HhvmCompatibilityTest extends \PHPUnit_Framework_TestCase
1414
{
1515
/**
1616
* @var array
@@ -38,7 +38,7 @@ class IniGetSetTest extends \PHPUnit_Framework_TestCase
3838
'default_socket_timeout',
3939
];
4040

41-
public function testAllowedGetSetDirectives()
41+
public function testAllowedIniGetSetDirectives()
4242
{
4343
$deniedDirectives = [];
4444
foreach ($this->getFiles() as $file) {

dev/tools/Magento/Tools/View/deploy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343

4444
try {
4545
// run the deployment logic
46-
$filesUtil = new \Magento\Framework\Test\Utility\Files(BP);
46+
$filesUtil = new \Magento\Framework\App\Utility\Files(BP);
4747
$omFactory = \Magento\Framework\App\Bootstrap::createObjectManagerFactory(BP, []);
4848
$objectManager = $omFactory->create(
4949
[\Magento\Framework\App\State::PARAM_MODE => \Magento\Framework\App\State::MODE_DEFAULT]

lib/internal/Magento/Framework/Test/Unit/PhraseTest.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,4 @@ protected function removeRendererFromPhrase()
9292
$property->setAccessible(true);
9393
$property->setValue($this->phrase, null);
9494
}
95-
96-
public function testGlobalFunction()
97-
{
98-
$this->assertFalse(is_object(__('Test')));
99-
}
10095
}

0 commit comments

Comments
 (0)