Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ public function testGetSolutionIdSandbox($environment, $expectedSolution)
$this->assertEquals($expectedSolution, $this->model->getSolutionId(123));
}

/**
* @return array
*/
public function configMapProvider()
{
return [
Expand All @@ -97,6 +100,10 @@ public function configMapProvider()
['getTransactionInfoSyncKeys', 'transactionSyncKeys', 'a,b,c', ['a', 'b', 'c']],
];
}

/**
* @return array
*/
public function environmentUrlProvider()
{
return [
Expand All @@ -105,6 +112,9 @@ public function environmentUrlProvider()
];
}

/**
* @return array
*/
public function environmentSolutionProvider()
{
return [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,22 @@ public function testBuildWithBothAddresses()
$this->assertEquals('abc', $result['transactionRequest']['customerIP']);
}

/**
* @param $responseData
* @param $addressPrefix
*/
private function validateAddressData($responseData, $addressPrefix)
{
foreach ($this->mockAddressData as $fieldValue => $field) {
$this->assertEquals($addressPrefix . $field['sampleData'], $responseData[$fieldValue]);
}
}

/**
* @param $prefix
*
* @return \PHPUnit\Framework\MockObject\MockObject
*/
private function createAddressMock($prefix)
{
$addressAdapterMock = $this->createMock(AddressAdapterInterface::class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ public function testDoesNothingWhenPending(string $status)
$this->handler->handle($subject, $response);
}

/**
* @return array
*/
public function pendingTransactionStatusesProvider()
{
return [
Expand All @@ -120,6 +123,9 @@ public function pendingTransactionStatusesProvider()
];
}

/**
* @return array
*/
public function declinedTransactionStatusesProvider()
{
return [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@ public function testIsExist($fileName, $fileMediaPath)
$this->assertTrue($this->model->isExist($fileName));
}

/**
* @return array
*/
public function isExistProvider()
{
return [
Expand All @@ -213,6 +216,9 @@ public function testIsBeginsWithMediaDirectoryPath($fileName, $expected)
$this->assertEquals($expected, $this->model->isBeginsWithMediaDirectoryPath($fileName));
}

/**
* @return array
*/
public function isBeginsWithMediaDirectoryPathProvider()
{
return [
Expand Down
3 changes: 3 additions & 0 deletions app/code/Magento/Catalog/Test/Unit/Model/ProductTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,9 @@ public function testGetStoreSingleSiteModelIds(
$this->assertEquals($websiteIDs, $this->model->getStoreIds());
}

/**
* @return array
*/
public function getSingleStoreIds()
{
return [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ public function testProcess($cartData, $expected)
$this->assertEquals($this->requestProcessor->process($cartData), $expected);
}

/**
* @return array
*/
public function cartDataProvider()
{
return [
Expand Down
3 changes: 3 additions & 0 deletions app/code/Magento/ImportExport/Test/Unit/Model/ImportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,9 @@ public function testGetUnknownEntity($entity)
$import->getEntity();
}

/**
* @return array
*/
public function unknownEntitiesProvider()
{
return [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function testCanShowBlock()
->method('isEnabled')
->with($this->catalogLayerMock, $filters)
->will($this->returnValue($enabled));

$category = $this->createMock(Category::class);
$this->catalogLayerMock->expects($this->atLeastOnce())->method('getCurrentCategory')->willReturn($category);
$category->expects($this->once())->method('getDisplayMode')->willReturn(Category::DM_PRODUCT);
Expand All @@ -119,12 +119,12 @@ public function testCanShowBlock()
public function testCanShowBlockWithDifferentDisplayModes(string $mode, bool $result)
{
$filters = ['To' => 'be', 'or' => 'not', 'to' => 'be'];

$this->filterListMock->expects($this->atLeastOnce())->method('getFilters')
->with($this->catalogLayerMock)
->will($this->returnValue($filters));
$this->assertEquals($filters, $this->model->getFilters());

$this->visibilityFlagMock
->expects($this->any())
->method('isEnabled')
Expand All @@ -137,6 +137,9 @@ public function testCanShowBlockWithDifferentDisplayModes(string $mode, bool $re
$this->assertEquals($result, $this->model->canShowBlock());
}

/**
* @return array
*/
public function canShowBlockDataProvider()
{
return [
Expand Down
6 changes: 6 additions & 0 deletions app/code/Magento/Sales/Test/Unit/Model/OrderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1253,6 +1253,9 @@ public function testGetCreatedAtFormattedUsesCorrectLocale()
$this->order->getCreatedAtFormatted(\IntlDateFormatter::SHORT);
}

/**
* @return array
*/
public function notInvoicingStatesProvider()
{
return [
Expand All @@ -1262,6 +1265,9 @@ public function notInvoicingStatesProvider()
];
}

/**
* @return array
*/
public function canNotCreditMemoStatesProvider()
{
return [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ public function testCheck(
$this->assertEquals($expectedState, $this->orderMock->getState());
}

/**
* @return array
*/
public function stateCheckDataProvider()
{
return [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ public function testGetPageSize($searchEngine, $size)
$this->assertEquals($size, $this->model->getMaxPageSize());
}

/**
* @return array
*/
public function getPageSizeDataProvider()
{
return [
Expand Down
3 changes: 3 additions & 0 deletions app/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
* @return \Magento\Framework\Phrase
*/
if (!function_exists('__')) {
/**
* @return \Magento\Framework\Phrase
*/
function __()
{
$argc = func_get_args();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ protected function setUp()
$this->key = substr(__CLASS__, -32, 32);
}

/**
* @param int $length
*
* @return string
*/
protected function getRandomString(int $length): string
{
$result = '';
Expand All @@ -48,18 +53,33 @@ private function requireCipherInfo()
}
}

/**
* @param string $cipherName
* @param string $modeName
*
* @return int
*/
private function getKeySize(string $cipherName, string $modeName): int
{
$this->requireCipherInfo();
return self::$cipherInfo[$cipherName][$modeName]['key_size'];
}

/**
* @param string $cipherName
* @param string $modeName
*
* @return int
*/
private function getInitVectorSize(string $cipherName, string $modeName): int
{
$this->requireCipherInfo();
return self::$cipherInfo[$cipherName][$modeName]['iv_size'];
}

/**
* @return array
*/
public function getCipherModeCombinations(): array
{
$result = [];
Expand Down Expand Up @@ -87,6 +107,9 @@ public function testConstructor(string $cipher, string $mode)
$this->assertEquals($initVector, $crypt->getInitVector());
}

/**
* @return array
*/
public function getConstructorExceptionData(): array
{
$key = substr(__CLASS__, -32, 32);
Expand Down Expand Up @@ -130,6 +153,9 @@ public function testConstructorDefaults()
$this->assertEquals($cryptExpected->getInitVector(), $cryptActual->getInitVector());
}

/**
* @return array
*/
public function getCryptData(): array
{
$fixturesFilename = __DIR__ . '/../Crypt/_files/_crypt_fixtures.php';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ public function testIsValid($key, $expected = true)
$this->assertEquals($expected, $this->keyValidator->isValid($key));
}

/**
* @return array
*/
public function isValidDataProvider() : array
{
return [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,11 @@ public function testMultiDimensionProviderWithMixedDataProvider()
}
}

/**
* @param $dimensions
*
* @return \PHPUnit\Framework\MockObject\MockObject
*/
private function getDimensionProviderMock($dimensions)
{
$dimensionProviderMock = $this->getMockBuilder(DimensionProviderInterface::class)
Expand All @@ -233,6 +238,12 @@ function () use ($dimensions) {
return $dimensionProviderMock;
}

/**
* @param string $name
* @param string $value
*
* @return \PHPUnit\Framework\MockObject\MockObject
*/
private function getDimensionMock(string $name, string $value)
{
$dimensionMock = $this->getMockBuilder(Dimension::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class JsonHexTagTest extends \PHPUnit\Framework\TestCase
* @var \Magento\Framework\Serialize\Serializer\Json
*/
private $json;

protected function setUp()
{
$objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
Expand All @@ -37,6 +37,9 @@ public function testSerialize($value, $expected)
);
}

/**
* @return array
*/
public function serializeDataProvider()
{
$dataObject = new DataObject(['something']);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ public function testExecute(array $currentConfig, array $correctConfig, string $
$this->assertEquals($expectedOutput, $tester->getDisplay());
}

/**
* @return array
*/
public function executeDataProvider()
{
$successMessage = 'The modules configuration is up to date.' . PHP_EOL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,13 @@ public function testIndexAction()
$this->assertInstanceOf(\Zend\View\Model\JsonModel::class, $model);
}

/**
* @param \PHPUnit\Framework\MockObject\MockObject $request
* @param \PHPUnit\Framework\MockObject\MockObject $response
* @param \PHPUnit\Framework\MockObject\MockObject $routeMatch
*
* @return \PHPUnit\Framework\MockObject\MockObject
*/
protected function getMvcEventMock(
MockObject $request,
MockObject $response,
Expand Down