コード例 #1
0
 /**
  * @test
  * @return void
  */
 public function generateUuidGeneratesUuidAndRegistersProxyAsNewObject()
 {
     $className = 'Class' . md5(uniqid(mt_rand(), true));
     eval('class ' . $className . ' implements \\Neos\\Flow\\Persistence\\Aspect\\PersistenceMagicInterface { public $Persistence_Object_Identifier = NULL; }');
     $object = new $className();
     $this->mockJoinPoint->expects($this->atLeastOnce())->method('getProxy')->will($this->returnValue($object));
     $this->mockPersistenceManager->expects($this->atLeastOnce())->method('registerNewObject')->with($object);
     $this->persistenceMagicAspect->generateUuid($this->mockJoinPoint);
     $this->assertEquals(36, strlen($object->Persistence_Object_Identifier));
 }
コード例 #2
0
 /**
  * @test
  * @todo adjust when AfterInvocationInterceptor is used again
  */
 public function enforcePolicyDoesNotInvokeInterceptorIfAuthorizationChecksAreDisabled()
 {
     $this->mockAdviceChain->expects($this->once())->method('proceed')->with($this->mockJoinPoint);
     $this->mockJoinPoint->expects($this->once())->method('getAdviceChain')->will($this->returnValue($this->mockAdviceChain));
     $this->mockSecurityContext->expects($this->atLeastOnce())->method('areAuthorizationChecksDisabled')->will($this->returnValue(true));
     $this->mockPolicyEnforcementInterceptor->expects($this->never())->method('invoke');
     $this->policyEnforcementAspect->enforcePolicy($this->mockJoinPoint);
 }