Skip to content

Commit

Permalink
Merge pull request #12033 from cakephp/here-attribute
Browse files Browse the repository at this point in the history
Add 'here' to the emulated property set.
  • Loading branch information
jeremyharris committed May 1, 2018
2 parents 0cb6d51 + a87b80b commit 9ff2776
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Http/ServerRequest.php
Expand Up @@ -196,7 +196,7 @@ class ServerRequest implements ArrayAccess, ServerRequestInterface
*
* @var array
*/
protected $emulatedAttributes = ['session', 'webroot', 'base', 'params'];
protected $emulatedAttributes = ['session', 'webroot', 'base', 'params', 'here'];

/**
* Array of Psr\Http\Message\UploadedFileInterface objects.
Expand Down
3 changes: 3 additions & 0 deletions tests/TestCase/Http/ServerRequestTest.php
Expand Up @@ -3590,13 +3590,15 @@ public function testGetAttributesCompatibility($prop)
'controller' => 'Articles',
'action' => 'index'
],
'url' => '/articles/view',
'base' => '/cakeapp',
'webroot' => '/cakeapp/'
]);

if ($prop === 'session') {
$this->assertSame($request->getSession(), $request->getAttribute($prop));
} else {
$this->assertNotEmpty($request->getAttribute($prop));
$this->assertSame($request->{$prop}, $request->getAttribute($prop));
}
});
Expand Down Expand Up @@ -3733,6 +3735,7 @@ public function testGetEnv()
public function emulatedPropertyProvider()
{
return [
['here'],
['params'],
['base'],
['webroot'],
Expand Down

0 comments on commit 9ff2776

Please sign in to comment.