Skip to content

Commit

Permalink
Merge pull request #147 from dereuromark/depr
Browse files Browse the repository at this point in the history
Remove deprecation.
  • Loading branch information
dereuromark authored Sep 5, 2024
2 parents f08d798 + 6cddf1c commit 3ee25b1
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 5 deletions.
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<php>
<!-- E_ALL => 32767 -->
<!-- E_ALL & ~E_USER_DEPRECATED => 16383 -->
<ini name="error_reporting" value="16383"/>
<ini name="error_reporting" value="32767"/>

<env name="FIXTURE_SCHEMA_METADATA" value="tests/schema.php"/>
</php>
Expand Down
2 changes: 1 addition & 1 deletion src/Auth/MultiColumnAuthenticate.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ protected function _query(string $username): SelectQuery {
$options['username'] = $username;
}

return $table->find($finder, $options);
return $table->find($finder, ...$options);
}

}
4 changes: 4 additions & 0 deletions tests/Fixture/UsersFixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class UsersFixture extends TestFixture {
public array $fields = [
'id' => ['type' => 'integer'],
'username' => ['type' => 'string', 'null' => false, 'length' => 64, 'comment' => '', 'charset' => 'utf8'],
'email' => ['type' => 'string', 'null' => false, 'length' => 64, 'comment' => '', 'charset' => 'utf8'],
'role_id' => ['type' => 'integer', 'null' => false, 'default' => '0', 'length' => 11, 'collate' => null, 'comment' => ''],
'_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]],
];
Expand All @@ -30,16 +31,19 @@ class UsersFixture extends TestFixture {
[
'id' => '1',
'username' => 'dereuromark',
'email' => '[email protected]',
'role_id' => ROLE_USER,
],
[
'id' => '2',
'username' => 'bravo-kernel',
'email' => '[email protected]',
'role_id' => ROLE_ADMIN,
],
[
'id' => '3',
'username' => 'adriana',
'email' => '[email protected]',
'role_id' => ROLE_MODERATOR,
],
];
Expand Down
45 changes: 45 additions & 0 deletions tests/TestCase/Auth/MultiColumnAuthenticateTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

namespace TinyAuth\Test\TestCase\Auth;

use Cake\Controller\ComponentRegistry;
use Cake\Controller\Controller;
use Cake\Http\Response;
use Cake\Http\ServerRequest;
use Cake\TestSuite\TestCase;
use TinyAuth\Auth\MultiColumnAuthenticate;

/**
* Test case for TinyAuth Authentication
*/
class MultiColumnAuthenticateTest extends TestCase {

/**
* @var array<string>
*/
protected array $fixtures = [
'plugin.TinyAuth.Users',
];

/**
* Test applying config in the constructor
*
* @return void
*/
public function testGetUser() {
$request = new ServerRequest();
$request = $request->withData('login', 'dereuromark');
$request = $request->withData('password', '123');

$object = new MultiColumnAuthenticate(new ComponentRegistry(new Controller($request)), [
'fields' => [
'username' => 'login',
'password' => 'password',
],
'columns' => ['username', 'email'],
]);
$result = $object->authenticate($request, new Response());
$this->assertFalse($result);
}

}
2 changes: 1 addition & 1 deletion tests/TestCase/Auth/TinyAuthorizeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
class TinyAuthorizeTest extends TestCase {

/**
* @var array
* @var array<string>
*/
protected array $fixtures = [
'plugin.TinyAuth.Users',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
class AuthUserComponentTest extends TestCase {

/**
* @var array
* @var array<string>
*/
protected array $fixtures = [
'core.Sessions',
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/Utility/TinyAuthTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
class TinyAuthTest extends TestCase {

/**
* @var array
* @var array<string>
*/
protected array $fixtures = [
'plugin.TinyAuth.DatabaseRoles',
Expand Down

0 comments on commit 3ee25b1

Please sign in to comment.