コード例 #1
0
 /**
  * @test
  * @expectedException \InvalidArgumentException
  * @expectedExceptionCode 1425236663
  */
 public function moduleDispatcherIsCalled()
 {
     $GLOBALS['TBE_MODULES'] = array('_PATHS' => array('module_fixture' => __DIR__ . '/../Fixtures/ModuleFixture/'));
     $this->requestMock->expects($this->any())->method('getQueryParams')->will($this->returnValue(array('M' => 'module_fixture')));
     $this->formProtectionMock->expects($this->once())->method('validateToken')->will($this->returnValue(true));
     $this->subject->expects($this->once())->method('boot');
     $this->subject->expects($this->atLeastOnce())->method('getFormProtection')->will($this->returnValue($this->formProtectionMock));
     $this->subject->handleRequest($this->requestMock);
 }
コード例 #2
0
 /**
  * @test
  */
 public function constructorUsesProvidedArguments()
 {
     $server = ['foo' => 'bar', 'baz' => 'bat'];
     $server['server'] = true;
     $files = ['files' => new UploadedFile('php://temp', 0, 0)];
     $uri = new Uri('http://example.com');
     $method = 'POST';
     $headers = ['host' => ['example.com']];
     $request = new ServerRequest($uri, $method, 'php://memory', $headers, $server, $files);
     $this->assertEquals($server, $request->getServerParams());
     $this->assertEquals($files, $request->getUploadedFiles());
     $this->assertSame($uri, $request->getUri());
     $this->assertEquals($method, $request->getMethod());
     $this->assertEquals($headers, $request->getHeaders());
     $body = $request->getBody();
     $r = new \ReflectionProperty($body, 'stream');
     $r->setAccessible(true);
     $stream = $r->getValue($body);
     $this->assertEquals('php://memory', $stream);
 }