"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/TestSuite/IntegrationTestTrait.php" between
cakephp-4.0.1.tar.gz and cakephp-4.0.2.tar.gz

About: CakePHP is a rapid development framework for PHP applications. Source code.

IntegrationTestTrait.php  (cakephp-4.0.1):IntegrationTestTrait.php  (cakephp-4.0.2)
skipping to change at line 61 skipping to change at line 61
use Cake\TestSuite\Constraint\Session\FlashParamEquals; use Cake\TestSuite\Constraint\Session\FlashParamEquals;
use Cake\TestSuite\Constraint\Session\SessionEquals; use Cake\TestSuite\Constraint\Session\SessionEquals;
use Cake\TestSuite\Constraint\View\LayoutFileEquals; use Cake\TestSuite\Constraint\View\LayoutFileEquals;
use Cake\TestSuite\Constraint\View\TemplateFileEquals; use Cake\TestSuite\Constraint\View\TemplateFileEquals;
use Cake\TestSuite\Stub\TestExceptionRenderer; use Cake\TestSuite\Stub\TestExceptionRenderer;
use Cake\Utility\CookieCryptTrait; use Cake\Utility\CookieCryptTrait;
use Cake\Utility\Hash; use Cake\Utility\Hash;
use Cake\Utility\Security; use Cake\Utility\Security;
use Cake\Utility\Text; use Cake\Utility\Text;
use Exception; use Exception;
use Laminas\Diactoros\Uri;
use LogicException; use LogicException;
use PHPUnit\Framework\Error\Error as PhpUnitError; use PHPUnit\Framework\Error\Error as PhpUnitError;
use Throwable; use Throwable;
use Zend\Diactoros\Uri;
/** /**
* A trait intended to make integration tests of your controllers easier. * A trait intended to make integration tests of your controllers easier.
* *
* This test class provides a number of helper methods and features * This test class provides a number of helper methods and features
* that make dispatching requests and checking their responses simpler. * that make dispatching requests and checking their responses simpler.
* It favours full integration tests over mock objects as you can test * It favours full integration tests over mock objects as you can test
* more of your code easily and avoid some of the maintenance pitfalls * more of your code easily and avoid some of the maintenance pitfalls
* that mock objects create. * that mock objects create.
*/ */
skipping to change at line 663 skipping to change at line 663
*/ */
protected function _addTokens(string $url, array $data): array protected function _addTokens(string $url, array $data): array
{ {
if ($this->_securityToken === true) { if ($this->_securityToken === true) {
$fields = array_diff_key($data, array_flip($this->_unlockedFields)); $fields = array_diff_key($data, array_flip($this->_unlockedFields));
$keys = array_map(function ($field) { $keys = array_map(function ($field) {
return preg_replace('/(\.\d+)+$/', '', $field); return preg_replace('/(\.\d+)+$/', '', $field);
}, array_keys(Hash::flatten($fields))); }, array_keys(Hash::flatten($fields)));
$formProtector = new FormProtector($url, 'cli', ['unlockedFields' => $this->_unlockedFields]); $formProtector = new FormProtector(['unlockedFields' => $this->_unlo ckedFields]);
foreach ($keys as $field) { foreach ($keys as $field) {
/** @psalm-suppress PossiblyNullArgument */ /** @psalm-suppress PossiblyNullArgument */
$formProtector->addField($field); $formProtector->addField($field);
} }
$tokenData = $formProtector->buildTokenData(); $tokenData = $formProtector->buildTokenData($url, 'cli');
$data['_Token'] = $tokenData; $data['_Token'] = $tokenData;
$data['_Token']['debug'] = 'FormProtector debug data would be added here'; $data['_Token']['debug'] = 'FormProtector debug data would be added here';
} }
if ($this->_csrfToken === true) { if ($this->_csrfToken === true) {
if (!isset($this->_cookie['csrfToken'])) { if (!isset($this->_cookie['csrfToken'])) {
$this->_cookie['csrfToken'] = Text::uuid(); $this->_cookie['csrfToken'] = Text::uuid();
} }
if (!isset($data['_csrfToken'])) { if (!isset($data['_csrfToken'])) {
 End of changes. 4 change blocks. 
3 lines changed or deleted 3 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)