/**
  * Test the logoutAdapters method.
  *
  * @depends testGetEventWithEventSet
  * @covers ZfcUser\Authentication\Adapter\AdapterChain::logoutAdapters
  */
 public function testLogoutAdapters()
 {
     $event = new AdapterChainEvent();
     $this->eventManager->expects($this->once())->method('trigger')->with('logout', $event);
     $this->adapterChain->setEvent($event);
     $this->adapterChain->logoutAdapters();
 }
Exemple #2
0
 public function testListenersAreRegistered()
 {
     $event = $this->getEvent();
     $options = new ModuleOptions(['register_http_method_override_listener' => true]);
     $this->serviceLocator->setService(ModuleOptions::class, $options);
     // --------------------------------------------------------------------------------
     // Test that HTTP exception listener is registered
     // --------------------------------------------------------------------------------
     $this->serviceLocator->setService(HttpExceptionListener::class, $this->getMock(HttpExceptionListener::class));
     $this->eventManager->expects($this->at(0))->method('attachAggregate')->with($this->isInstanceOf(HttpExceptionListener::class));
     // --------------------------------------------------------------------------------
     // Test that HTTP response listener is registered
     // --------------------------------------------------------------------------------
     $this->serviceLocator->setService(ResourceResponseListener::class, $this->getMock(ResourceResponseListener::class));
     $this->eventManager->expects($this->at(1))->method('attachAggregate')->with($this->isInstanceOf(ResourceResponseListener::class));
     // --------------------------------------------------------------------------------
     // Test the HTTP method override listener is registered
     // --------------------------------------------------------------------------------
     $this->serviceLocator->setService(HttpMethodOverrideListener::class, $this->getMock(HttpMethodOverrideListener::class));
     $this->eventManager->expects($this->at(2))->method('attachAggregate')->with($this->isInstanceOf(HttpMethodOverrideListener::class));
     $module = new Module();
     $module->onBootstrap($event);
 }
 public function testCommitRevision()
 {
     $repositoryConfig = $this->moduleConfig['permissions']['Athene2Test\\VersioningTest\\Asset\\RepositoryFake'];
     $permission = $repositoryConfig[ModuleOptions::KEY_PERMISSION_COMMIT];
     $data = ['foo' => 'bar'];
     $this->authorizationService->expects($this->any())->method('getIdentity')->will($this->returnValue($this->identity));
     $this->authorizationService->expects($this->once())->method('isGranted')->with($permission)->will($this->returnValue(true));
     $this->objectManager->expects($this->atLeastOnce())->method('persist');
     $this->eventManager->expects($this->once())->method('trigger')->with(VersioningEvent::COMMIT);
     $this->repositoryManager->setEventManager($this->eventManager);
     $revision = $this->repositoryManager->commitRevision($this->repository, $data);
     $this->assertSame($this->repository, $revision->getRepository());
     $this->assertSame($this->identity, $revision->getAuthor());
     $this->assertSame('bar', $revision->get('foo'));
     $this->assertEquals($revision, current($this->repository->getRevisions()));
 }
 public function testDetachDoesNothing()
 {
     $this->events->expects(self::never())->method(self::anything());
     $this->sut->detach($this->events);
 }
 /**
  * @covers \Zend\Stdlib\Hydrator\Aggregate\AggregateHydrator::extract
  */
 public function testExtract()
 {
     $object = new stdClass();
     $this->eventManager->expects($this->once())->method('trigger')->with($this->isInstanceOf('Zend\\Stdlib\\Hydrator\\Aggregate\\ExtractEvent'));
     $this->assertSame(array(), $this->hydrator->extract($object));
 }