From 64ed390de053f78827392b91da2ea9a87d7402ff Mon Sep 17 00:00:00 2001 From: Mark Story Date: Sun, 14 Aug 2016 11:45:18 -0400 Subject: [PATCH] Minor fixups. * Don't allocate 3 arrays when we can do it in one. * Use methods instead of manipulating internal state. --- src/Http/ResponseTransformer.php | 2 +- .../CookieEncryptedUsingControllerTest.php | 14 ++------------ 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/Http/ResponseTransformer.php b/src/Http/ResponseTransformer.php index 2bc2b8aef39..09b4dbfa4d1 100644 --- a/src/Http/ResponseTransformer.php +++ b/src/Http/ResponseTransformer.php @@ -101,7 +101,7 @@ protected static function parseCookies(array $cookieHeader) } list($name, $value) = explode('=', array_shift($parts), 2); - $parsed = compact('name') + ['value' => urldecode($value)]; + $parsed = ['name' => $name, 'value' => urldecode($value)]; foreach ($parts as $part) { if (strpos($part, '=') !== false) { diff --git a/tests/TestCase/TestSuite/CookieEncryptedUsingControllerTest.php b/tests/TestCase/TestSuite/CookieEncryptedUsingControllerTest.php index ad17d2b185c..65a4bdef147 100644 --- a/tests/TestCase/TestSuite/CookieEncryptedUsingControllerTest.php +++ b/tests/TestCase/TestSuite/CookieEncryptedUsingControllerTest.php @@ -41,17 +41,7 @@ public function setUp() DispatcherFactory::clear(); DispatcherFactory::add('Routing'); DispatcherFactory::add('ControllerFactory'); - } - - /** - * tear down. - * - * @return void - */ - public function tearDown() - { - parent::tearDown(); - $this->_useHttpServer = false; + $this->useHttpServer(false); } /** @@ -157,7 +147,7 @@ public function testCanAssertCookieEncryptedWithAnotherEncryptionKey() */ public function testCanAssertCookieEncryptedWithAesWhenUsingPsr7() { - $this->_useHttpServer = true; + $this->useHttpServer(true); $this->get('/cookie_component_test/set_cookie'); $this->assertCookieEncrypted('abc', 'NameOfCookie', 'aes'); }