public function testMatchNoZone()
 {
     $request = new Request();
     $request->attributes->set(FOSRestBundle::ZONE_ATTRIBUTE, false);
     $event = $this->getMock('Symfony\\Component\\HttpKernel\\Event\\GetResponseEvent', [], [], '', false);
     $event->expects($this->once())->method('getRequest')->willReturn($request);
     $this->listener->onKernelRequest($event);
     $this->assertFalse($this->listener->getVersion());
 }
 public function testMatchNoZone()
 {
     $this->listener->setRegex('/(v|version)=(?P<version>[0-9\\.]+)/');
     $request = new Request();
     $request->attributes->set(FOSRestBundle::ZONE_ATTRIBUTE, false);
     $request->attributes->set('media_type', 'application/json;v=1.2');
     $event = $this->getMock('Symfony\\Component\\HttpKernel\\Event\\GetResponseEvent', [], [], '', false);
     $event->expects($this->once())->method('getRequest')->willReturn($request);
     $this->listener->onKernelRequest($event);
     $this->assertFalse($this->listener->getVersion());
 }
 public function testMatch()
 {
     $this->listener->setRegex('/(v|version)=(?P<version>[0-9\\.]+)/');
     $request = $this->getMock('Symfony\\Component\\HttpFoundation\\Request');
     $attributesBag = $this->getMock('Symfony\\Component\\HttpFoundation\\ParameterBag');
     $attributesBag->expects($this->once())->method('get')->with('media_type')->willReturn('application/json/v=1.2');
     $request->attributes = $attributesBag;
     $event = $this->getMock('Symfony\\Component\\HttpKernel\\Event\\GetResponseEvent', array(), array(), '', false);
     $event->expects($this->once())->method('getRequest')->willReturn($request);
     $this->listener->onKernelRequest($event);
     $this->assertEquals('1.2', $this->listener->getVersion());
 }