-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ENGCOM-8155: Fix for queue numeric argument conversion #26967
- Merge Pull Request #26967 from bartoszkubicki/magento2:queue-exchange-argument-processor-fix - Merged commits: 1. d60cbb9 2. 5e7d9f6 3. 314ec92 4. 69eca07 5. 1fd7015 6. 7e97fb4 7. 8c8b9cf 8. 0c6d204
- Loading branch information
Showing
3 changed files
with
101 additions
and
14 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
70 changes: 70 additions & 0 deletions
70
lib/internal/Magento/Framework/Amqp/Test/Unit/Topology/ArgumentProcessorTest.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 | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\Framework\Amqp\Test\Unit\Topology; | ||
|
||
use InvalidArgumentException; | ||
use Magento\Framework\Amqp\Topology\ArgumentProcessor; | ||
use PHPUnit\Framework\MockObject\MockObject; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class ArgumentProcessorTest extends TestCase | ||
{ | ||
/** | ||
* @var ArgumentProcessor|MockObject | ||
*/ | ||
private $argumentProcessor; | ||
|
||
/** | ||
* @return void | ||
*/ | ||
public function testProcessArgumentsWhenAnyArgumentIsIncorrect(): void | ||
{ | ||
$arguments = [ | ||
'test' => new class { | ||
} | ||
]; | ||
|
||
$this->expectException(InvalidArgumentException::class); | ||
$this->argumentProcessor->processArguments($arguments); | ||
} | ||
|
||
/** | ||
* @return void | ||
*/ | ||
public function testProcessArgumentsWhenAllArgumentAreCorrect(): void | ||
{ | ||
$arguments = [ | ||
'array_type' => ['some_key' => 'some_value'], | ||
'numeric_value' => '25', | ||
'integer_value' => 26, | ||
'boolean_value' => false, | ||
'string_value' => 'test' | ||
]; | ||
|
||
$expected = [ | ||
'array_type' => ['A', ['some_key' => 'some_value']], | ||
'numeric_value' => ['I', 25], | ||
'integer_value' => ['I', 26], | ||
'boolean_value' => ['t', false], | ||
'string_value' => ['S', 'test'] | ||
]; | ||
|
||
$this->assertSame($expected, $this->argumentProcessor->processArguments($arguments)); | ||
} | ||
|
||
/** | ||
* @return void | ||
*/ | ||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
$this->argumentProcessor = $this->getMockForTrait(ArgumentProcessor::class); | ||
} | ||
} |
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