From 44935ed589f4c4af9fc9446452189a8a59ddf12a Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Mon, 24 Aug 2015 02:59:41 +0100 Subject: [PATCH] Providing `AbstractBaseFactory` tests to validate #254 revert Closes #256 --- .../Factory/AbstractBaseFactoryTest.php | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/tests/ProxyManagerTest/Factory/AbstractBaseFactoryTest.php b/tests/ProxyManagerTest/Factory/AbstractBaseFactoryTest.php index f699863d2..83d7a2ad2 100644 --- a/tests/ProxyManagerTest/Factory/AbstractBaseFactoryTest.php +++ b/tests/ProxyManagerTest/Factory/AbstractBaseFactoryTest.php @@ -157,9 +157,26 @@ public function testGeneratesClass() $this->signatureChecker->expects($this->atLeastOnce())->method('checkSignature'); $this->classSignatureGenerator->expects($this->once())->method('addSignature')->will($this->returnArgument(0)); - - $this->assertSame($generatedClass, $generateProxy->invoke($this->factory, stdClass::class)); + $this + ->generator + ->expects($this->once()) + ->method('generate') + ->with( + $this->callback(function (\ReflectionClass $reflectionClass) { + return $reflectionClass->getName() === 'stdClass'; + }), + $this->isInstanceOf(ClassGenerator::class), + ['some' => 'proxy', 'options' => 'here'] + ); + + $this->assertSame( + $generatedClass, + $generateProxy->invoke($this->factory, stdClass::class, ['some' => 'proxy', 'options' => 'here']) + ); $this->assertTrue(class_exists($generatedClass, false)); - $this->assertSame($generatedClass, $generateProxy->invoke($this->factory, stdClass::class)); + $this->assertSame( + $generatedClass, + $generateProxy->invoke($this->factory, stdClass::class, ['some' => 'proxy', 'options' => 'here']) + ); } }