Skip to content

Commit

Permalink
Was added description to exceptions, annotations to properties and cl…
Browse files Browse the repository at this point in the history
…asses. Implemented validation of exception message in unit test
  • Loading branch information
ArtsiomBruneuski authored and gelanivishal committed Oct 12, 2018
1 parent a20968d commit 2f2cafe
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public function validateResponseHandlersType($serviceName, $methodName, $handler
* @param string $typeName
* @return $this
* @throws \Exception In case when type is invalid
* @throws \InvalidArgumentException
` * @throws \InvalidArgumentException if methods don't have annotation
*/
protected function validateType($typeName)
{
Expand Down
8 changes: 4 additions & 4 deletions lib/internal/Magento/Framework/Reflection/MethodsMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ public function getMethodReturnType($typeName, $methodName)
* 'validatePassword' => 'boolean'
* ]
* </pre>
* @throws \InvalidArgumentException
* @throws \ReflectionException
* @throws \InvalidArgumentException if methods don't have annotation
* @throws \ReflectionException for missing DocBock or invalid reflection class
*/
public function getMethodsMap($interfaceName)
{
Expand Down Expand Up @@ -150,8 +150,8 @@ public function getMethodParams($serviceClassName, $serviceMethodName)
*
* @param string $interfaceName
* @return array
* @throws \ReflectionException
* @throws \InvalidArgumentException
* @throws \ReflectionException for missing DocBock or invalid reflection class
* @throws \InvalidArgumentException if methods don't have annotation
*/
private function getMethodMapViaReflection($interfaceName)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Framework\Test\Unit\Communication\Config;


use Magento\Framework\Communication\Config\Validator;
use Magento\Framework\Reflection\MethodsMap;
use Magento\Framework\Reflection\TypeProcessor;

/**
* Unit test for \Magento\Framework\Communication\Config\Validator class
*/
class ValidatorTest extends \PHPUnit\Framework\TestCase
{
/**
* @var TypeProcessor|\PHPUnit_Framework_MockObject_MockObject
*/
protected $typeProcessor;

/**
* @var MethodsMap|\PHPUnit_Framework_MockObject_MockObject
*/
protected $methodsMap;

public function setUp()
Expand All @@ -19,7 +32,6 @@ public function setUp()
->method('getMethodsMap')
->will($this->throwException(new \InvalidArgumentException('message', 333)));


$this->typeProcessor = $this->createMock(TypeProcessor::class);
$this->typeProcessor->expects(static::any())
->method('isTypeSimple')
Expand All @@ -33,6 +45,7 @@ public function setUp()
/**
* @expectedException \LogicException
* @expectedExceptionCode 333
* @expectedExceptionMessage Response schema definition has service class with wrong annotated methods
*/
public function testValidateResponseSchemaType()
{
Expand All @@ -44,6 +57,7 @@ public function testValidateResponseSchemaType()
/**
* @expectedException \LogicException
* @expectedExceptionCode 333
* @expectedExceptionMessage Request schema definition has service class with wrong annotated methods
*/
public function testValidateRequestSchemaType()
{
Expand Down

0 comments on commit 2f2cafe

Please sign in to comment.