public function testHandleAnnotationAttributesShallAppent()
 {
     $listener = new ElementAnnotationsListener();
     $event = new Zend\EventManager\Event();
     $annotation = new Doctrine\ORM\Mapping\Column();
     $annotation->type = 'text';
     $event->setParam('annotation', $annotation);
     $event->setParam('elementSpec', new ArrayObject(array('spec' => array('attributes' => array('attr1' => 'value')))));
     $listener->handleAttributesAnnotation($event);
     $spec = $event->getParam('elementSpec');
     $this->assertCount(2, $spec['spec']['attributes']);
     $this->assertArrayHasKey('attr1', $spec['spec']['attributes']);
     $this->assertEquals('textarea', $spec['spec']['attributes']['type']);
     $this->assertEquals('value', $spec['spec']['attributes']['attr1']);
 }
Example #2
0
 /**
  * Check a request for a valid file asset.
  *
  * @param  Zend\EventManager\Event $event
  * @return void
  */
 public function checkRequestUriForAsset($event)
 {
     $request = $event->getRequest();
     if (!method_exists($request, 'uri')) {
         return;
     }
     if (method_exists($request, 'getBaseUrl')) {
         $baseUrlLength = strlen($request->getBaseUrl() ?: '');
     } else {
         $baseUrlLength = 0;
     }
     $path = substr($request->uri()->getPath(), $baseUrlLength);
     foreach ($this->assetPaths as $assetPath) {
         if (file_exists($assetPath . $path)) {
             $this->sendFile($assetPath . $path);
         }
     }
 }
 /**
  * Tests the mechanism for casting one event type to AdapterChainEvent
  *
  * @covers ZfcUser\Authentication\Adapter\AdapterChain::setEvent
  */
 public function testSetEventWithDifferentEventType()
 {
     $testParams = array('testParam' => 'testValue');
     $event = new \Zend\EventManager\Event();
     $event->setParams($testParams);
     $this->adapterChain->setEvent($event);
     $returnEvent = $this->adapterChain->getEvent();
     $this->assertInstanceOf('ZfcUser\\Authentication\\Adapter\\AdapterChainEvent', $returnEvent, 'Asserting the adapter in an instance of ZfcUser\\Authentication\\Adapter\\AdapterChainEvent');
     $this->assertEquals($testParams, $returnEvent->getParams(), 'Asserting event parameters match');
 }