-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TestFramework: extended reflection helper
- Loading branch information
Mike Gladysch
committed
Apr 5, 2016
1 parent
6514d24
commit 106e5f3
Showing
2 changed files
with
48 additions
and
8 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
41 changes: 41 additions & 0 deletions
41
src/glady/Behind/TestFramework/UnitTest/Helper/ReflectionWrapper.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,41 @@ | ||
<?php | ||
/* | ||
* This file is part of the Behind-Project (https://github.com/glady/Behind). | ||
* | ||
* (c) Mike Gladysch <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace glady\Behind\src\glady\Behind\TestFramework\UnitTest\Helper; | ||
|
||
use glady\Behind\TestFramework\UnitTest\Helper\Reflection; | ||
|
||
/** | ||
* Class ReflectionWrapper | ||
* @package glady\Behind\src\glady\Behind\TestFramework\UnitTest\Helper | ||
*/ | ||
class ReflectionWrapper | ||
{ | ||
/** | ||
* @param object $object | ||
*/ | ||
public function __construct($object) | ||
{ | ||
$this->original = $object; | ||
$this->reflection = new Reflection(); | ||
} | ||
|
||
|
||
/** | ||
* @param string $name | ||
* @param array $arguments | ||
* @return mixed | ||
*/ | ||
public function __call($name, $arguments) | ||
{ | ||
$method = $this->reflection->getMethod($this->original, $name); | ||
return $method->invokeArgs($this->original, $arguments); | ||
} | ||
} |