class ObjectManagerDecoratorTest in Plug 7
Hierarchy
- class \Doctrine\Tests\Common\Persistence\ObjectManagerDecoratorTest extends \Doctrine\Tests\Common\Persistence\PHPUnit_Framework_TestCase
Expanded class hierarchy of ObjectManagerDecoratorTest
File
- lib/
doctrine/ common/ tests/ Doctrine/ Tests/ Common/ Persistence/ ObjectManagerDecoratorTest.php, line 16
Namespace
Doctrine\Tests\Common\PersistenceView source
class ObjectManagerDecoratorTest extends \PHPUnit_Framework_TestCase {
private $wrapped;
private $decorated;
public function setUp() {
$this->wrapped = $this
->getMock('Doctrine\\Common\\Persistence\\ObjectManager');
$this->decorated = new NullObjectManagerDecorator($this->wrapped);
}
public function getMethodParameters() {
$class = new \ReflectionClass('Doctrine\\Common\\Persistence\\ObjectManager');
$methods = array();
foreach ($class
->getMethods() as $method) {
if ($method
->getNumberOfRequiredParameters() === 0) {
$methods[] = array(
$method
->getName(),
array(),
);
}
elseif ($method
->getNumberOfRequiredParameters() > 0) {
$methods[] = array(
$method
->getName(),
array_fill(0, $method
->getNumberOfRequiredParameters(), 'req') ?: array(),
);
}
if ($method
->getNumberOfParameters() != $method
->getNumberOfRequiredParameters()) {
$methods[] = array(
$method
->getName(),
array_fill(0, $method
->getNumberOfParameters(), 'all') ?: array(),
);
}
}
return $methods;
}
/**
* @dataProvider getMethodParameters
*/
public function testAllMethodCallsAreDelegatedToTheWrappedInstance($method, array $parameters) {
$stub = $this->wrapped
->expects($this
->once())
->method($method)
->will($this
->returnValue('INNER VALUE FROM ' . $method));
call_user_func_array(array(
$stub,
'with',
), $parameters);
$this
->assertSame('INNER VALUE FROM ' . $method, call_user_func_array(array(
$this->decorated,
$method,
), $parameters));
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ObjectManagerDecoratorTest:: |
private | property | ||
ObjectManagerDecoratorTest:: |
private | property | ||
ObjectManagerDecoratorTest:: |
public | function | ||
ObjectManagerDecoratorTest:: |
public | function | ||
ObjectManagerDecoratorTest:: |
public | function | @dataProvider getMethodParameters |