Skip to content

Commit

Permalink
Add more tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
dereuromark committed Nov 9, 2019
1 parent 0e603ca commit cbe51c8
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Utility/TinyAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function __construct(array $config = []) {
}

/**
* @return string[]
* @return int[]
*/
public function getAvailableRoles() {
$roles = $this->_getAvailableRoles();
Expand Down
34 changes: 34 additions & 0 deletions tests/TestCase/Utility/TinyAuthTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

namespace TinyAuth\Test\TestCase\Utility;

use Cake\TestSuite\TestCase;
use TinyAuth\Utility\TinyAuth;

class TinyAuthTest extends TestCase {

/**
* @var array
*/
public $fixtures = [
'plugin.TinyAuth.DatabaseRoles',
];

/**
* @return void
*/
public function testGetAvailableRoles() {
$config = [
'rolesTable' => 'DatabaseRoles',
];

$result = (new TinyAuth($config))->getAvailableRoles();
$expected = [
'user' => 11,
'moderator' => 12,
'admin' => 13
];
$this->assertEquals($expected, $result);
}

}

0 comments on commit cbe51c8

Please sign in to comment.