Skip to content

Commit

Permalink
pull in attributes from symfony request object
Browse files Browse the repository at this point in the history
  • Loading branch information
Jared King committed Dec 25, 2018
1 parent abcab1d commit e708aa2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/SymfonyHttpBridge.php
Expand Up @@ -28,7 +28,10 @@ public function convertSymfonyRequest(SymfonyRequest $request)
$session = [];
}

return new Request($request->query->all(), $request->request->all(), $request->cookies->all(), $request->files->all(), $request->server->all(), $session);
$req = new Request($request->query->all(), $request->request->all(), $request->cookies->all(), $request->files->all(), $request->server->all(), $session);
$req->setParams($request->attributes->all());

return $req;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions tests/SymfonyHttpBridgeTest.php
Expand Up @@ -16,6 +16,7 @@ public function testConvertSymfonyRequest()
$bridge = new SymfonyHttpBridge();
$server = ['REQUEST_METHOD' => 'GET'];
$request = SymfonyRequest::create('/', 'GET', ['test' => true], ['test2' => true], ['test3' => []], $server);
$request->attributes->set('test4', true);

$infuseRequest = $bridge->convertSymfonyRequest($request);

Expand All @@ -24,6 +25,7 @@ public function testConvertSymfonyRequest()
$this->assertEquals(['test' => true], $infuseRequest->query());
$this->assertEquals(['test2' => true], $infuseRequest->cookies());
$this->assertEquals(['test3' => []], $infuseRequest->files());
$this->assertEquals(['test4' => true], $infuseRequest->params());
}

public function testConvertInfuseResponse()
Expand Down

0 comments on commit e708aa2

Please sign in to comment.