public function testCheckSignatureWithInvalidValue() { $this->signatureGenerator->expects($this->any())->method('generateSignatureKey')->with(array('foo' => 'bar'))->will($this->returnValue('Example')); $this->signatureGenerator->expects($this->any())->method('generateSignature')->with(array('foo' => 'bar'))->will($this->returnValue('invalid-signature')); $this->setExpectedException('ProxyManager\\Signature\\Exception\\InvalidSignatureException'); $this->signatureChecker->checkSignature(new ReflectionClass($this), array('foo' => 'bar')); }
public function testAddSignature() { /* @var $classGenerator \PHPUnit_Framework_MockObject_MockObject|\Zend\Code\Generator\ClassGenerator */ $classGenerator = $this->getMock('Zend\\Code\\Generator\\ClassGenerator'); $classGenerator->expects($this->once())->method('addPropertyFromGenerator')->with($this->callback(function (PropertyGenerator $property) { return $property->getName() === 'signaturePropertyName' && $property->isStatic() && $property->getVisibility() === 'private' && $property->getDefaultValue()->getValue() === 'valid-signature'; })); $this->signatureGenerator->expects($this->any())->method('generateSignature')->with(array('foo' => 'bar'))->will($this->returnValue('valid-signature')); $this->signatureGenerator->expects($this->any())->method('generateSignatureKey')->with(array('foo' => 'bar'))->will($this->returnValue('PropertyName')); $this->classSignatureGenerator->addSignature($classGenerator, array('foo' => 'bar')); }