Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
dereuromark committed Sep 23, 2024
1 parent 6c2bd0c commit 59fc4fb
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions tests/TestCase/Auth/FormAuthenticateTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?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\FormAuthenticate;

class FormAuthenticateTest extends TestCase {

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

/**
* @return void
*/
public function testAuthenticate() {
$request = new ServerRequest();
$request = $request->withData('username', 'dereuromark');
$request = $request->withData('password', '123');

$object = new FormAuthenticate(new ComponentRegistry(new Controller($request)));
$result = $object->authenticate($request, new Response());
$this->assertTrue((bool)$result);
}

}

0 comments on commit 59fc4fb

Please sign in to comment.