-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
catch InvalidArgumentException, throw correct message, unit test
- Loading branch information
1 parent
3109909
commit 9afdfee
Showing
2 changed files
with
70 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
58 changes: 58 additions & 0 deletions
58
lib/internal/Magento/Framework/Test/Unit/Communication/Config/ValidatorTest.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,58 @@ | ||
<?php | ||
/** | ||
* m2git | ||
*/ | ||
|
||
namespace Magento\Framework\Test\Unit\Communication\Config; | ||
|
||
|
||
use Magento\Framework\Communication\Config\Validator; | ||
use Magento\Framework\Reflection\MethodsMap; | ||
use Magento\Framework\Reflection\TypeProcessor; | ||
|
||
class ValidatorTest extends \PHPUnit\Framework\TestCase | ||
{ | ||
protected $typeProcessor; | ||
protected $methodsMap; | ||
|
||
public function setUp() | ||
{ | ||
$this->methodsMap = $this->createMock(MethodsMap::class); | ||
|
||
$this->methodsMap->expects(static::any()) | ||
->method('getMethodsMap') | ||
->will($this->throwException(new \InvalidArgumentException())); | ||
|
||
|
||
$this->typeProcessor = $this->createMock(TypeProcessor::class); | ||
$this->typeProcessor->expects(static::any()) | ||
->method('isTypeSimple') | ||
->willReturn(false); | ||
|
||
$this->typeProcessor->expects(static::any()) | ||
->method('isTypeSimple') | ||
->willReturn(false); | ||
} | ||
|
||
/** | ||
* @expectedException \LogicException | ||
* @expectedExceptionCode 123 | ||
*/ | ||
public function testValidateResponseSchemaType() | ||
{ | ||
/** @var Validator $validator */ | ||
$validator = new Validator($this->typeProcessor, $this->methodsMap); | ||
$validator->validateResponseSchemaType('123', '123'); | ||
} | ||
|
||
/** | ||
* @expectedException \LogicException | ||
* @expectedExceptionCode 123 | ||
*/ | ||
public function testValidateRequestSchemaType() | ||
{ | ||
/** @var Validator $validator */ | ||
$validator = new Validator($this->typeProcessor, $this->methodsMap); | ||
$validator->validateRequestSchemaType('123', '123'); | ||
} | ||
} |