diff --git a/psalm.xml b/psalm.xml
index 3bcbd74e4..1de17a837 100644
--- a/psalm.xml
+++ b/psalm.xml
@@ -14,7 +14,6 @@
-
diff --git a/src/Controller/AppController.php b/src/Controller/AppController.php
index 68c4951e2..f2a6011c9 100644
--- a/src/Controller/AppController.php
+++ b/src/Controller/AppController.php
@@ -28,7 +28,7 @@ class AppController extends BaseController
public function initialize(): void
{
parent::initialize();
- $this->loadComponent('Security');
+ $this->loadComponent('FormProtection');
if ($this->request->getParam('_csrfToken') === false) {
$this->loadComponent('Csrf');
}
diff --git a/src/Controller/Traits/PasswordManagementTrait.php b/src/Controller/Traits/PasswordManagementTrait.php
index 0e8c186f7..f26361604 100644
--- a/src/Controller/Traits/PasswordManagementTrait.php
+++ b/src/Controller/Traits/PasswordManagementTrait.php
@@ -209,6 +209,6 @@ public function resetOneTimePasswordAuthenticator($id = null)
}
}
- return $this->redirect($this->getRequest()->referer());
+ return $this->redirect($this->getRequest()->referer() ?? '/');
}
}
diff --git a/tests/Fixture/UsersFixture.php b/tests/Fixture/UsersFixture.php
index d48f6dc55..13db4d856 100644
--- a/tests/Fixture/UsersFixture.php
+++ b/tests/Fixture/UsersFixture.php
@@ -64,8 +64,9 @@ public function init(): void
'type' => 'Webauthn\TrustPath\EmptyTrustPath',
],
'aaguid' => '00000000-0000-0000-0000-000000000000',
- 'credentialPublicKey' => Base64Url::encode('000000000000000000000000000000000000-9999999999999999999999999999999999999999-XXXXXXXXXXXXX-ZZZZZZZZZZZ'),
- 'userHandle' => Base64Url::encode('00000000-0000-0000-0000-000000000001'),
+ //add this when migrated webauthn
+// 'credentialPublicKey' => Base64Url::encode('000000000000000000000000000000000000-9999999999999999999999999999999999999999-XXXXXXXXXXXXX-ZZZZZZZZZZZ'),
+// 'userHandle' => Base64Url::encode('00000000-0000-0000-0000-000000000001'),
'counter' => 190,
'otherUI' => null,
],
diff --git a/tests/TestCase/Authenticator/SocialAuthenticatorTest.php b/tests/TestCase/Authenticator/SocialAuthenticatorTest.php
index d20ba65fc..759a36651 100644
--- a/tests/TestCase/Authenticator/SocialAuthenticatorTest.php
+++ b/tests/TestCase/Authenticator/SocialAuthenticatorTest.php
@@ -36,7 +36,7 @@
*/
class SocialAuthenticatorTest extends TestCase
{
- public $fixtures = [
+ protected array $fixtures = [
'plugin.CakeDC/Users.Users',
'plugin.CakeDC/Users.SocialAccounts',
];
diff --git a/tests/TestCase/Authenticator/SocialPendingEmailAuthenticatorTest.php b/tests/TestCase/Authenticator/SocialPendingEmailAuthenticatorTest.php
index 949153707..3309dcded 100644
--- a/tests/TestCase/Authenticator/SocialPendingEmailAuthenticatorTest.php
+++ b/tests/TestCase/Authenticator/SocialPendingEmailAuthenticatorTest.php
@@ -25,7 +25,7 @@
class SocialPendingEmailAuthenticatorTest extends TestCase
{
- public $fixtures = [
+ protected array $fixtures = [
'plugin.CakeDC/Users.Users',
'plugin.CakeDC/Users.SocialAccounts',
];
diff --git a/tests/TestCase/Controller/SocialAccountsControllerTest.php b/tests/TestCase/Controller/SocialAccountsControllerTest.php
index 47a544d7e..3677a3cb0 100644
--- a/tests/TestCase/Controller/SocialAccountsControllerTest.php
+++ b/tests/TestCase/Controller/SocialAccountsControllerTest.php
@@ -15,7 +15,7 @@
use Cake\Core\Configure;
use Cake\Http\ServerRequest;
-use Cake\Mailer\Email;
+use Cake\Mailer\Mailer;
use Cake\Mailer\TransportFactory;
use Cake\TestSuite\TestCase;
@@ -26,7 +26,7 @@ class SocialAccountsControllerTest extends TestCase
*
* @var array
*/
- public $fixtures = [
+ protected array $fixtures = [
'plugin.CakeDC/Users.SocialAccounts',
'plugin.CakeDC/Users.Users',
];
@@ -46,9 +46,9 @@ public function setUp(): void
Configure::write('Users.RememberMe.active', false);
TransportFactory::setConfig('test', ['className' => 'Debug']);
- $this->configEmail = Email::getConfig('default');
- Email::drop('default');
- Email::setConfig('default', [
+ $this->configEmail = Mailer::getConfig('default');
+ Mailer::drop('default');
+ Mailer::setConfig('default', [
'transport' => 'test',
'from' => 'cakedc@example.com',
]);
@@ -69,9 +69,9 @@ public function setUp(): void
*/
public function tearDown(): void
{
- Email::drop('default');
+ Mailer::drop('default');
TransportFactory::drop('test');
- //Email::setConfig('default', $this->configEmail);
+ //Mailer::setConfig('default', $this->configEmail);
Configure::write('Opauth', $this->configOpauth);
Configure::write('Users.RememberMe.active', $this->configRememberMe);
diff --git a/tests/TestCase/Controller/Traits/BaseTraitTest.php b/tests/TestCase/Controller/Traits/BaseTraitTest.php
index 693940e8a..0c7bdad5a 100644
--- a/tests/TestCase/Controller/Traits/BaseTraitTest.php
+++ b/tests/TestCase/Controller/Traits/BaseTraitTest.php
@@ -21,7 +21,8 @@
use Cake\Controller\ComponentRegistry;
use Cake\Controller\Controller;
use Cake\Event\Event;
-use Cake\Mailer\Email;
+use Cake\Http\ServerRequest;
+use Cake\Mailer\Mailer;
use Cake\Mailer\TransportFactory;
use Cake\ORM\Entity;
use Cake\ORM\TableRegistry;
@@ -42,7 +43,7 @@ abstract class BaseTraitTest extends TestCase
*
* @var array
*/
- public $fixtures = [
+ protected array $fixtures = [
'plugin.CakeDC/Users.Users',
];
@@ -85,6 +86,7 @@ public function setUp(): void
try {
$this->Trait = $this->getMockBuilder($this->traitClassName)
->setMethods($traitMockMethods)
+ ->setConstructorArgs([new ServerRequest()])
->getMock();
$this->Trait->expects($this->any())
->method('getUsersTable')
@@ -98,9 +100,9 @@ public function setUp(): void
TransportFactory::setConfig('test', [
'className' => 'Debug',
]);
- $this->configEmail = Email::getConfig('default');
- Email::drop('default');
- Email::setConfig('default', [
+ $this->configEmail = Mailer::getConfig('default');
+ Mailer::drop('default');
+ Mailer::setConfig('default', [
'transport' => 'test',
'from' => 'cakedc@example.com',
]);
@@ -116,9 +118,9 @@ public function tearDown(): void
{
unset($this->table, $this->Trait);
if ($this->mockDefaultEmail) {
- Email::drop('default');
+ Mailer::drop('default');
TransportFactory::drop('test');
- //Email::setConfig('default', $this->setConfigEmail);
+ //Mailer::setConfig('default', $this->setConfigEmail);
}
parent::tearDown();
}
diff --git a/tests/TestCase/Controller/Traits/CustomUsersTableTraitTest.php b/tests/TestCase/Controller/Traits/CustomUsersTableTraitTest.php
index 8bad2e04b..ebe2b8c88 100644
--- a/tests/TestCase/Controller/Traits/CustomUsersTableTraitTest.php
+++ b/tests/TestCase/Controller/Traits/CustomUsersTableTraitTest.php
@@ -13,6 +13,7 @@
namespace CakeDC\Users\Test\TestCase\Controller\Traits;
+use Cake\Http\ServerRequest;
use Cake\ORM\Table;
use Cake\TestSuite\TestCase;
@@ -23,6 +24,7 @@ public function setUp(): void
parent::setUp();
$this->controller = $this->getMockBuilder('Cake\Controller\Controller')
->setMethods(['header', 'redirect', 'render', '_stop'])
+ ->setConstructorArgs([new ServerRequest()])
->getMock();
$this->controller->Trait = $this->getMockForTrait('CakeDC\Users\Controller\Traits\CustomUsersTableTrait');
}
diff --git a/tests/TestCase/Controller/Traits/Integration/LoginTraitIntegrationTest.php b/tests/TestCase/Controller/Traits/Integration/LoginTraitIntegrationTest.php
index 9bf8d74d4..8d270230c 100644
--- a/tests/TestCase/Controller/Traits/Integration/LoginTraitIntegrationTest.php
+++ b/tests/TestCase/Controller/Traits/Integration/LoginTraitIntegrationTest.php
@@ -28,7 +28,7 @@ class LoginTraitIntegrationTest extends TestCase
*
* @var array
*/
- public $fixtures = [
+ protected array $fixtures = [
'plugin.CakeDC/Users.Users',
];
@@ -72,6 +72,7 @@ public function testLoginGetRequestNoSocialLogin()
});
$this->get('/login');
+ file_put_contents(TMP . 'testLoginGetRequestNoSocialLogin.html', $this->_response->getBody());
$this->assertResponseOk();
$this->assertResponseNotContains('Username or password is incorrect');
$this->assertResponseContains('