コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function apply(Request $request, ParamConverter $configuration)
 {
     $name = $configuration->getName();
     $slug = $request->get($name);
     $elect = $this->electsService->getElectFromSlug($slug);
     $request->attributes->set('elect', $elect);
     return true;
 }
コード例 #2
0
 /**
  * Test get Elect from slug.
  *
  * @see ElectsService::getElectFromSlug
  */
 public function testGetElectFromSlug()
 {
     $manager = $this->getManager();
     $manager->expects($this->once())->method('getDBResults')->will($this->returnValue([$this->fixtures->simpleElect]));
     $service = new ElectsService($manager, new RepresentationHydrator());
     $elect = $service->getElectFromSlug('xavier-dateu-77e30c6');
     $this->assertInstanceOf(Elect::class, $elect);
 }