Skip to content

Commit bee641d

Browse files
author
silinmykola
committed
fixed unit tests
1 parent 476f06b commit bee641d

File tree

4 files changed

+21
-4
lines changed

4 files changed

+21
-4
lines changed

app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/ValidatorTest.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use Magento\CatalogImportExport\Model\Import\Product\Validator;
1313
use Magento\CatalogImportExport\Model\Import\Product\Validator\Media;
1414
use Magento\CatalogImportExport\Model\Import\Product\Validator\Website;
15+
use Magento\Framework\Stdlib\StringUtils;
1516
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
1617
use Magento\ImportExport\Model\Import;
1718
use PHPUnit\Framework\MockObject\MockObject;
@@ -64,7 +65,10 @@ protected function setUp(): void
6465
$this->objectManagerHelper = new ObjectManagerHelper($this);
6566
$this->validator = $this->objectManagerHelper->getObject(
6667
Validator::class,
67-
['validators' => $this->validators]
68+
[
69+
'validators' => $this->validators,
70+
'string' => new StringUtils()
71+
]
6872
);
6973
$this->validator->init($this->context);
7074
}
@@ -108,7 +112,7 @@ public function attributeValidationProvider()
108112
[
109113
'any_behavior',
110114
[],
111-
['product_type' => 'any'],
115+
['product_type' => 'any', 'sku' => ''],
112116
false,
113117
Product::COL_SKU
114118
],

app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,10 @@ protected function getModelMock($mockBeforeSave = false)
582582
->method('_getCurrentDateTime')
583583
->willReturn('2012-12-21T00:00:00-08:00');
584584

585+
$model->expects($this->any())
586+
->method('_getBaseDir')
587+
->willReturn('');
588+
585589
$model->expects($this->any())
586590
->method('_getDocumentRoot')
587591
->willReturn('/project');

lib/internal/Magento/Framework/App/Test/Unit/MaintenanceModeTest.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,16 @@ class MaintenanceModeTest extends TestCase
3737
*/
3838
protected function setup(): void
3939
{
40-
$this->flagDir = $this->getMockForAbstractClass(WriteInterface::class);
40+
$this->flagDir = $this->getMockForAbstractClass(
41+
WriteInterface::class,
42+
[],
43+
'',
44+
false,
45+
true,
46+
true,
47+
['readFile']
48+
);
49+
$this->flagDir->method('readFile')->willReturn('');
4150
$filesystem = $this->createMock(Filesystem::class);
4251
$filesystem->method('getDirectoryWrite')
4352
->willReturn($this->flagDir);

setup/src/Magento/Setup/Test/Unit/Fixtures/CartPriceRulesFixtureTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ public function testGenerateAdvancedCondition($ruleId, $categoriesArray, $ruleCo
222222
'type' => Address::class,
223223
'attribute' => 'region',
224224
'operator' => '==',
225-
'value' => $regions[($ruleId / 4) % 50],
225+
'value' => $regions[intdiv($ruleId, 4) % 50],
226226
];
227227

228228
$secondCondition = [

0 commit comments

Comments
 (0)