Skip to content

Commit

Permalink
Add asserts to testAdapterMethods
Browse files Browse the repository at this point in the history
  • Loading branch information
muglug committed Feb 3, 2018
1 parent 128ac5e commit 74ba592
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions test/unit/Reflection/Adapter/ReflectionMethodTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
use Roave\BetterReflection\Reflection\Adapter\Exception\NotImplemented;
use Roave\BetterReflection\Reflection\Adapter\ReflectionClass as ReflectionClassAdapter;
use Roave\BetterReflection\Reflection\Adapter\ReflectionMethod as ReflectionMethodAdapter;
use Roave\BetterReflection\Reflection\Adapter\ReflectionParameter as ReflectionParameterAdapter;
use Roave\BetterReflection\Reflection\Adapter\ReflectionType as ReflectionTypeAdapter;
use Roave\BetterReflection\Reflection\Exception\NoObjectProvided;
use Roave\BetterReflection\Reflection\Exception\NotAnObject;
use Roave\BetterReflection\Reflection\Exception\ObjectNotInstanceOfClass;
Expand Down Expand Up @@ -67,7 +69,7 @@ public function methodExpectationProvider() : array
['isUserDefined', null, true, []],
['getClosureThis', NotImplemented::class, null, []],
['getClosureScopeClass', NotImplemented::class, null, []],
['getDocComment', null, '', []],
['getDocComment', null, false, []],
['getStartLine', null, 123, []],
['getEndLine', null, 123, []],
['getExtension', NotImplemented::class, null, []],
Expand Down Expand Up @@ -122,7 +124,24 @@ public function testAdapterMethods(string $methodName, ?string $expectedExceptio
}

$adapter = new ReflectionMethodAdapter($reflectionStub);
$adapter->{$methodName}(...$args);
$adapterReturnValue = $adapter->{$methodName}(...$args);

switch ($methodName) {
case 'getParameters':
$this->assertContainsOnly(ReflectionParameterAdapter::class, $adapterReturnValue);
break;

case 'getReturnType':
$this->assertInstanceOf(ReflectionTypeAdapter::class, $adapterReturnValue);
break;

case 'getPrototype':
$this->assertInstanceOf(ReflectionMethodAdapter::class, $adapterReturnValue);
break;

default:
$this->assertEquals($returnValue, $adapterReturnValue);
}
}

public function testExport() : void
Expand Down

0 comments on commit 74ba592

Please sign in to comment.