Skip to content

Commit daf007a

Browse files
committed
Fix tests.
1 parent 3a65729 commit daf007a

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

tests/TestCase/Auth/TinyAuthorizeTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace TinyAuth\Test\Auth;
44

55
use Cake\Controller\ComponentRegistry;
6+
use Cake\Controller\Controller;
67
use Cake\Core\Configure;
78
use Cake\Core\Exception\CakeException;
89
use Cake\Core\Plugin;
@@ -47,9 +48,8 @@ class TinyAuthorizeTest extends TestCase {
4748
public function setUp(): void {
4849
parent::setUp();
4950

50-
$this->collection = new ComponentRegistry();
51-
5251
$this->request = new ServerRequest();
52+
$this->collection = new ComponentRegistry(new Controller($this->request));
5353

5454
Configure::write('Roles', [
5555
'user' => ROLE_USER,

tests/TestCase/Command/TinyAuthSyncCommandTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Cake\Console\TestSuite\ConsoleIntegrationTestTrait;
77
use Cake\Core\Configure;
88
use Cake\TestSuite\TestCase;
9+
use TinyAuth\Filesystem\Folder;
910

1011
class TinyAuthSyncCommandTest extends TestCase {
1112

@@ -36,8 +37,8 @@ public function testSync() {
3637
Configure::write('TinyAuth.aclFilePath', TESTS . 'test_files/subfolder/');
3738
Configure::write('TinyAuth.allowFilePath', TESTS . 'test_files/');
3839

39-
//$folder = new Folder();
40-
//$folder->copy('/tmp' . DS . 'src' . DS . 'Controller' . DS, ['from' => TESTS . 'test_app' . DS . 'Controller' . DS]);
40+
$folder = new Folder();
41+
$folder->copy('/tmp' . DS . 'src' . DS . 'Controller' . DS, ['from' => TESTS . 'test_app' . DS . 'Controller' . DS]);
4142

4243
$this->exec('tiny_auth_sync foo,bar -d -v');
4344

tests/TestCase/Controller/Component/AuthUserComponentTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Cake\Http\ServerRequest;
1010
use Cake\TestSuite\TestCase;
1111
use TestApp\Controller\Component\TestAuthUserComponent;
12+
use TinyAuth\Controller\Component\AuthComponent;
1213
use TinyAuth\Utility\Cache;
1314

1415
class AuthUserComponentTest extends TestCase {
@@ -29,10 +30,14 @@ class AuthUserComponentTest extends TestCase {
2930
* @return void
3031
*/
3132
public function setUp(): void {
33+
$config = [
34+
'allowFilePath' => ROOT . DS . 'tests' . DS . 'test_files' . DS,
35+
];
36+
3237
$controller = new Controller(new ServerRequest());
3338
$componentRegistry = new ComponentRegistry($controller);
3439
$this->AuthUser = new TestAuthUserComponent($componentRegistry);
35-
//$this->AuthUser->Auth = $this->getMockBuilder(AuthComponent::class)->onlyMethods(['user'])->setConstructorArgs([$componentRegistry])->getMock();
40+
$this->AuthUser->Auth = $this->getMockBuilder(AuthComponent::class)->onlyMethods(['user'])->setConstructorArgs([$componentRegistry, $config])->getMock();
3641

3742
Configure::write('Roles', [
3843
'user' => 1,

tests/schema.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
$name = $matches[1];
1717
$tableName = Inflector::underscore($name);
18-
$class = 'Shim\\Test\\Fixture\\' . $name . 'Fixture';
18+
$class = 'TinyAuth\\Test\\Fixture\\' . $name . 'Fixture';
1919
try {
2020
$object = (new ReflectionClass($class))->getProperty('fields');
2121
} catch (ReflectionException $e) {

0 commit comments

Comments
 (0)