예제 #1
0
 public function testOnPreDispatchSubscriber()
 {
     $subscriber = new OnPreDispatchSubscriber();
     $evm = new Manager();
     $evm->addEventSubscriber($subscriber);
     $dm = $this->_getDrestManager($this->_em, null, $evm);
     $xHeader = '12345zyxabc';
     $request = \Symfony\Component\HttpFoundation\Request::create('/users?xHeader=' . $xHeader, 'GET');
     $response = $dm->dispatch($request);
     $this->assertEquals($xHeader, $response->getHttpHeader('xHeader'));
 }
예제 #2
0
 public function testOnPostDispatchSubscriber()
 {
     // Sets the body to the 'return' parameter contents
     $subscriber = new OnPostDispatchSubscriber();
     $evm = new Manager();
     $evm->addEventSubscriber($subscriber);
     $dm = $this->_getDrestManager($this->_em, null, $evm);
     $return = '12345zyxabc';
     $request = \Symfony\Component\HttpFoundation\Request::create('/users?return=' . $return, 'GET');
     $response = $dm->dispatch($request);
     $this->assertEquals($return, $response->getBody());
 }