public function testGetActions() { $this->annotationProvider->expects($this->once())->method('getAnnotations')->with($this->equalTo('action'))->will($this->returnValue(array(new AclAnnotation(array('id' => 'test', 'type' => 'action', 'group_name' => 'TestGroup', 'label' => 'TestLabel'))))); $action = new ActionMetadata('test', 'TestGroup', 'TestLabel'); $this->cache->expects($this->at(0))->method('fetch')->with(ActionMetadataProvider::CACHE_KEY)->will($this->returnValue(false)); $this->cache->expects($this->at(2))->method('fetch')->with(ActionMetadataProvider::CACHE_KEY)->will($this->returnValue(array('test' => $action))); $this->cache->expects($this->once())->method('save')->with(ActionMetadataProvider::CACHE_KEY, array('test' => $action)); // call without cache $actions = $this->provider->getActions(); $this->assertCount(1, $actions); $this->assertEquals($action, $actions[0]); // call with local cache $actions = $this->provider->getActions(); $this->assertCount(1, $actions); $this->assertEquals($action, $actions[0]); // call with cache $provider = new ActionMetadataProvider($this->annotationProvider, $this->cache); $actions = $provider->getActions(); $this->assertCount(1, $actions); $this->assertEquals($action, $actions[0]); }
/** * {@inheritdoc} */ public function getClasses() { return $this->actionMetadataProvider->getActions(); }