Skip to content

Commit

Permalink
Fixed incorrect return type hint for setSignKey
Browse files Browse the repository at this point in the history
See: #14982
  • Loading branch information
sergeyklay committed May 2, 2020
1 parent 4821b38 commit 726ece5
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 17 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-4.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- Fixed return type hints of the following `Phalcon\Acl\AbstractAdapter`'s methods: `getActiveAccess`, `getActiveRole` and `getActiveComponent` [#14974](https://github.com/phalcon/cphalcon/pull/14974)
- Fixed default value of the following `Phalcon\Annotations\Annotation`'s properties: `$arguments` and `$exprArguments` [#14977](https://github.com/phalcon/cphalcon/issues/14977)
- Fixed return type hints of the following `Phalcon\Annotations\Annotation`'s methods: `getArgument`, `getName` and `getNamedArgument` [#14977](https://github.com/phalcon/cphalcon/issues/14977)
- Fixed incorrect return type hint for `Phalcon\Http\Response\Cookies::setSignKey` [#14982](https://github.com/phalcon/cphalcon/issues/14982)

# [4.0.5](https://github.com/phalcon/cphalcon/releases/tag/v4.0.5) (2020-03-07)
## Added
Expand Down
6 changes: 3 additions & 3 deletions phalcon/Http/Response/Cookies.zep
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
*
* (c) Phalcon Team <[email protected]>
*
* For the full copyright and license information, please view the LICENSE.txt
* file that was distributed with this source code.
* For the full copyright and license information, please view the
* LICENSE.txt file that was distributed with this source code.
*/

namespace Phalcon\Http\Response;
Expand Down Expand Up @@ -312,7 +312,7 @@ class Cookies extends AbstractInjectionAware implements CookiesInterface
*
* @see \Phalcon\Security\Random
*/
public function setSignKey(string signKey = null) -> <CookieInterface>
public function setSignKey(string signKey = null) -> <CookiesInterface>
{
let this->signKey = signKey;

Expand Down
28 changes: 22 additions & 6 deletions tests/unit/Http/Response/Cookies/DeleteCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@
*
* (c) Phalcon Team <[email protected]>
*
* For the full copyright and license information, please view the LICENSE.txt
* file that was distributed with this source code.
* For the full copyright and license information, please view the
* LICENSE.txt file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Phalcon\Test\Unit\Http\Response\Cookies;

use Phalcon\Http\Response\Cookies;
use Phalcon\Storage\Exception;
use Phalcon\Test\Fixtures\Traits\CookieTrait;
use Phalcon\Test\Unit\Http\Helper\HttpBase;
use UnitTester;
Expand All @@ -23,17 +24,27 @@ class DeleteCest extends HttpBase
use CookieTrait;

/**
* executed before each test
* Executed before each test
*
* @param UnitTester $I
* @return void
*/
public function _before(UnitTester $I)
public function _before(UnitTester $I): void
{
parent::_before($I);
$this->setDiService('sessionStream');

try {
$this->setDiService('sessionStream');
} catch (Exception $e) {
$I->fail($e->getMessage());
}
}

/**
* Tests Phalcon\Http\Response\Cookies :: delete()
*
* @param UnitTester $I
*
* @author Jeremy PASTOURET <https://github.com/jenovateurs>
* @since 2020-01-06
*/
Expand All @@ -44,7 +55,12 @@ public function httpResponseCookiesDelete(UnitTester $I)
$sName = 'framework';
$sValue = 'phalcon';

$this->setDiService('crypt');
try {
$this->setDiService('crypt');
} catch (Exception $e) {
$I->fail($e->getMessage());
}

$container = $this->getDi();

$oCookie = new Cookies();
Expand Down
29 changes: 21 additions & 8 deletions tests/unit/Http/Response/Cookies/SetSignKeyCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@
*
* (c) Phalcon Team <[email protected]>
*
* For the full copyright and license information, please view the LICENSE.txt
* file that was distributed with this source code.
* For the full copyright and license information, please view the
* LICENSE.txt file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Phalcon\Test\Unit\Http\Response\Cookies;

use Phalcon\Http\Response\Cookies;
use Phalcon\Storage\Exception;
use Phalcon\Test\Fixtures\Traits\CookieTrait;
use Phalcon\Test\Unit\Http\Helper\HttpBase;
use UnitTester;
Expand All @@ -23,28 +24,40 @@ class SetSignKeyCest extends HttpBase
use CookieTrait;

/**
* executed before each test
* Executed before each test
*
* @param UnitTester $I
* @return void
*/
public function _before(UnitTester $I)
public function _before(UnitTester $I): void
{
parent::_before($I);
$this->setDiService('sessionStream');

try {
$this->setDiService('sessionStream');
} catch (Exception $e) {
$I->fail($e->getMessage());
}
}

/**
* Tests Phalcon\Http\Response\Cookies :: setSignKey()
*
* @param UnitTester $I
*
* @author Jeremy PASTOURET <https://github.com/jenovateurs>
* @since 2020-01-06
*/
public function httpResponseCookiesSetSignKey(UnitTester $I)
{
$I->wantToTest('Http\Response\Cookies - setSignKey()');

$sName = 'framework';
$sValue = 'phalcon';
try {
$this->setDiService('crypt');
} catch (Exception $e) {
$I->fail($e->getMessage());
}

$this->setDiService('crypt');
$container = $this->getDi();

$oCookie = new Cookies();
Expand Down

0 comments on commit 726ece5

Please sign in to comment.