"Fossies" - the Fresh Open Source Software Archive  

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

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

IntegrationTestTrait.php  (cakephp-4.2.2):IntegrationTestTrait.php  (cakephp-4.2.3)
skipping to change at line 171 skipping to change at line 171
* Boolean flag for whether or not the request should re-store * Boolean flag for whether or not the request should re-store
* flash messages * flash messages
* *
* @var bool * @var bool
*/ */
protected $_retainFlashMessages = false; protected $_retainFlashMessages = false;
/** /**
* Stored flash messages before render * Stored flash messages before render
* *
* @var array|null * @var array
*/ */
protected $_flashMessages; protected $_flashMessages = [];
/** /**
* @var string|null * @var string|null
*/ */
protected $_cookieEncryptionKey; protected $_cookieEncryptionKey;
/** /**
* List of fields that are excluded from field validation. * List of fields that are excluded from field validation.
* *
* @var string[] * @var string[]
skipping to change at line 208 skipping to change at line 208
$this->_cookie = []; $this->_cookie = [];
$this->_response = null; $this->_response = null;
$this->_exception = null; $this->_exception = null;
$this->_controller = null; $this->_controller = null;
$this->_viewName = null; $this->_viewName = null;
$this->_layoutName = null; $this->_layoutName = null;
$this->_requestSession = null; $this->_requestSession = null;
$this->_securityToken = false; $this->_securityToken = false;
$this->_csrfToken = false; $this->_csrfToken = false;
$this->_retainFlashMessages = false; $this->_retainFlashMessages = false;
$this->_flashMessages = [];
} }
/** /**
* Calling this method will enable a SecurityComponent * Calling this method will enable a SecurityComponent
* compatible token to be added to request data. This * compatible token to be added to request data. This
* lets you easily test actions protected by SecurityComponent. * lets you easily test actions protected by SecurityComponent.
* *
* @return void * @return void
*/ */
public function enableSecurityToken(): void public function enableSecurityToken(): void
skipping to change at line 515 skipping to change at line 516
*/ */
public function controllerSpy(EventInterface $event, ?Controller $controller = null): void public function controllerSpy(EventInterface $event, ?Controller $controller = null): void
{ {
if (!$controller) { if (!$controller) {
/** @var \Cake\Controller\Controller $controller */ /** @var \Cake\Controller\Controller $controller */
$controller = $event->getSubject(); $controller = $event->getSubject();
} }
$this->_controller = $controller; $this->_controller = $controller;
$events = $controller->getEventManager(); $events = $controller->getEventManager();
$flashCapture = function (EventInterface $event): void { $flashCapture = function (EventInterface $event): void {
if ($this->_retainFlashMessages && empty($this->_flashMessages)) { if (!$this->_retainFlashMessages) {
$controller = $event->getSubject(); return;
$this->_flashMessages = $controller->getRequest()->getSession()-
>read('Flash');
} }
$controller = $event->getSubject();
$this->_flashMessages = Hash::merge(
$this->_flashMessages,
$controller->getRequest()->getSession()->read('Flash')
);
}; };
$events->on('Controller.beforeRedirect', ['priority' => -100], $flashCap ture); $events->on('Controller.beforeRedirect', ['priority' => -100], $flashCap ture);
$events->on('Controller.beforeRender', ['priority' => -100], $flashCaptu re); $events->on('Controller.beforeRender', ['priority' => -100], $flashCaptu re);
$events->on('View.beforeRender', function ($event, $viewFile): void { $events->on('View.beforeRender', function ($event, $viewFile): void {
if (!$this->_viewName) { if (!$this->_viewName) {
$this->_viewName = $viewFile; $this->_viewName = $viewFile;
} }
}); });
$events->on('View.beforeLayout', function ($event, $viewFile): void { $events->on('View.beforeLayout', function ($event, $viewFile): void {
$this->_layoutName = $viewFile; $this->_layoutName = $viewFile;
 End of changes. 5 change blocks. 
6 lines changed or deleted 10 lines changed or added

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