Skip to content

Commit

Permalink
Providing AbstractBaseFactory tests to validate #254 revert
Browse files Browse the repository at this point in the history
Closes #256
  • Loading branch information
Ocramius committed Aug 24, 2015
1 parent 0793999 commit 44935ed
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions tests/ProxyManagerTest/Factory/AbstractBaseFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
);
}
}

0 comments on commit 44935ed

Please sign in to comment.