-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TE-10139 PHPStan 1.0 upgrade (#2095)
TE-10139 PHPStan 1.0 integration
- Loading branch information
1 parent
5c8de8f
commit a85b9f8
Showing
6 changed files
with
153 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
namespace: QuickOrderPage | ||
include: | ||
- tests/QuickOrderPageTest/Yves/QuickOrderPage | ||
paths: | ||
tests: tests | ||
log: tests/_output | ||
data: tests/_data | ||
support: tests/_support | ||
envs: tests/_envs | ||
settings: | ||
suite_class: \PHPUnit\Framework\TestSuite | ||
colors: true | ||
memory_limit: 1024M | ||
log: true | ||
coverage: | ||
enabled: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
tests/SprykerShopTest/Yves/QuickOrderPage/Business/ViewDataTransformerTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © 2016-present Spryker Systems GmbH. All rights reserved. | ||
* Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file. | ||
*/ | ||
|
||
namespace SprykerShopTest\Yves\QuickOrderPage\Business; | ||
|
||
use Codeception\Test\Unit; | ||
use Generated\Shared\Transfer\ProductMeasurementUnitTransfer; | ||
use SprykerShop\Yves\QuickOrderPage\ViewDataTransformer\ViewDataTransformer; | ||
use SprykerShop\Yves\QuickOrderPageExtension\Dependency\Plugin\QuickOrderFormColumnPluginInterface; | ||
|
||
/** | ||
* @group SprykerShop | ||
* @group Yves | ||
* @group QuickOrderPage | ||
* @group Business | ||
* @group ViewDataTransformerTest | ||
*/ | ||
class ViewDataTransformerTest extends Unit | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected const PATH = 'baseMeasurementUnit.name'; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
protected const PRODUCT_MEASUREMENT_UNIT_NAME = 'Name'; | ||
|
||
/** | ||
* @var \QuickOrderPageTest\Yves\QuickOrderPage\QuickOrderPageTester | ||
*/ | ||
protected $tester; | ||
|
||
/** | ||
* @return void | ||
*/ | ||
public function testTransformProductData(): void | ||
{ | ||
// Arrange | ||
$productConcreteTransfer = $this->tester->haveProduct(); | ||
$productConcreteTransfer->setBaseMeasurementUnit((new ProductMeasurementUnitTransfer())->setName(static::PRODUCT_MEASUREMENT_UNIT_NAME)); | ||
// Act | ||
$getDataByPath = (new ViewDataTransformer())->transformProductData([$productConcreteTransfer], [$this->getQuickOrderFormColumnPluginMock()]); | ||
|
||
// Assert | ||
$this->assertIsArray($getDataByPath); | ||
$this->assertIsArray($getDataByPath[$productConcreteTransfer->getSku()]); | ||
$this->assertIsArray($getDataByPath[$productConcreteTransfer->getSku()]['columns']); | ||
$this->assertEquals($productConcreteTransfer->getSku(), $getDataByPath[$productConcreteTransfer->getSku()]['sku']); | ||
$this->assertEquals($productConcreteTransfer->getName(), $getDataByPath[$productConcreteTransfer->getSku()]['name']); | ||
$this->assertEquals(static::PATH, array_key_first($getDataByPath[$productConcreteTransfer->getSku()]['columns'])); | ||
$this->assertEquals(static::PRODUCT_MEASUREMENT_UNIT_NAME, $getDataByPath[$productConcreteTransfer->getSku()]['columns'][static::PATH]); | ||
} | ||
|
||
/** | ||
* @return \PHPUnit\Framework\MockObject\MockObject|\SprykerShop\Yves\QuickOrderPageExtension\Dependency\Plugin\QuickOrderFormColumnPluginInterface | ||
*/ | ||
protected function getQuickOrderFormColumnPluginMock(): QuickOrderFormColumnPluginInterface | ||
{ | ||
$quickOrderFormColumnPluginMock = $this->getMockBuilder(QuickOrderFormColumnPluginInterface::class)->getMock(); | ||
$quickOrderFormColumnPluginMock->method('getDataPath')->willReturn(static::PATH); | ||
|
||
return $quickOrderFormColumnPluginMock; | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
tests/SprykerShopTest/Yves/QuickOrderPage/_support/QuickOrderPageTester.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © 2016-present Spryker Systems GmbH. All rights reserved. | ||
* Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file. | ||
*/ | ||
|
||
namespace SprykerShopTest\Yves\QuickOrderPage; | ||
|
||
use Codeception\Actor; | ||
|
||
/** | ||
* @method void wantToTest($text) | ||
* @method void wantTo($text) | ||
* @method void execute($callable) | ||
* @method void expectTo($prediction) | ||
* @method void expect($prediction) | ||
* @method void amGoingTo($argumentation) | ||
* @method void am($role) | ||
* @method void lookForwardTo($achieveValue) | ||
* @method void comment($description) | ||
* @method void pause() | ||
* | ||
* @SuppressWarnings(PHPMD) | ||
*/ | ||
class QuickOrderPageTester extends Actor | ||
{ | ||
use _generated\QuickOrderPageTesterActions; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
namespace: SprykerShopTest\Yves\QuickOrderPage | ||
paths: | ||
tests: . | ||
data: ../../../_data | ||
support: _support | ||
log: ../../../_output | ||
coverage: | ||
enabled: true | ||
remote: false | ||
whitelist: | ||
include: | ||
- '../../../../src/*' | ||
suites: | ||
Yves: | ||
path: . | ||
class_name: QuickOrderPageTester | ||
modules: | ||
enabled: | ||
- Asserts | ||
- \SprykerTest\Shared\Testify\Helper\Environment | ||
- \SprykerTest\Shared\Testify\Helper\LocatorHelper | ||
- \SprykerTest\Shared\Propel\Helper\TransactionHelper | ||
- \SprykerTest\Shared\Testify\Helper\DataCleanupHelper | ||
- \SprykerTest\Shared\Product\Helper\ProductDataHelper |