3
namespace Doctrine\Tests\Common\Persistence;
5
use Doctrine\Common\Persistence\ObjectManagerDecorator;
6
use Doctrine\Common\Persistence\ObjectManager;
8
class NullObjectManagerDecorator extends ObjectManagerDecorator
10
public function __construct(ObjectManager $wrapped)
12
$this->wrapped = $wrapped;
16
class ObjectManagerDecoratorTest extends \PHPUnit_Framework_TestCase
21
public function setUp()
23
$this->wrapped = $this->getMock('Doctrine\Common\Persistence\ObjectManager');
24
$this->decorated = new NullObjectManagerDecorator($this->wrapped);
27
public function getMethodParameters()
29
$class = new \ReflectionClass('Doctrine\Common\Persistence\ObjectManager');
32
foreach ($class->getMethods() as $method) {
33
if ($method->getNumberOfRequiredParameters() === 0) {
34
$methods[] = array($method->getName(), array());
35
} elseif ($method->getNumberOfRequiredParameters() > 0) {
36
$methods[] = array($method->getName(), array_fill(0, $method->getNumberOfRequiredParameters(), 'req') ?: array());
38
if ($method->getNumberOfParameters() != $method->getNumberOfRequiredParameters()) {
39
$methods[] = array($method->getName(), array_fill(0, $method->getNumberOfParameters(), 'all') ?: array());
47
* @dataProvider getMethodParameters
49
public function testAllMethodCallsAreDelegatedToTheWrappedInstance($method, array $parameters)
51
$stub = $this->wrapped
52
->expects($this->once())
54
->will($this->returnValue('INNER VALUE FROM ' . $method));
56
call_user_func_array(array($stub, 'with'), $parameters);
58
$this->assertSame('INNER VALUE FROM ' . $method, call_user_func_array(array($this->decorated, $method), $parameters));
b'\\ No newline at end of file'