File tree Expand file tree Collapse file tree 4 files changed +12
-6
lines changed Expand file tree Collapse file tree 4 files changed +12
-6
lines changed Original file line number Diff line number Diff line change 3
3
namespace TinyAuth \Test \Auth ;
4
4
5
5
use Cake \Controller \ComponentRegistry ;
6
+ use Cake \Controller \Controller ;
6
7
use Cake \Core \Configure ;
7
8
use Cake \Core \Exception \CakeException ;
8
9
use Cake \Core \Plugin ;
@@ -47,9 +48,8 @@ class TinyAuthorizeTest extends TestCase {
47
48
public function setUp (): void {
48
49
parent ::setUp ();
49
50
50
- $ this ->collection = new ComponentRegistry ();
51
-
52
51
$ this ->request = new ServerRequest ();
52
+ $ this ->collection = new ComponentRegistry (new Controller ($ this ->request ));
53
53
54
54
Configure::write ('Roles ' , [
55
55
'user ' => ROLE_USER ,
Original file line number Diff line number Diff line change 6
6
use Cake \Console \TestSuite \ConsoleIntegrationTestTrait ;
7
7
use Cake \Core \Configure ;
8
8
use Cake \TestSuite \TestCase ;
9
+ use TinyAuth \Filesystem \Folder ;
9
10
10
11
class TinyAuthSyncCommandTest extends TestCase {
11
12
@@ -36,8 +37,8 @@ public function testSync() {
36
37
Configure::write ('TinyAuth.aclFilePath ' , TESTS . 'test_files/subfolder/ ' );
37
38
Configure::write ('TinyAuth.allowFilePath ' , TESTS . 'test_files/ ' );
38
39
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 ]);
41
42
42
43
$ this ->exec ('tiny_auth_sync foo,bar -d -v ' );
43
44
Original file line number Diff line number Diff line change 9
9
use Cake \Http \ServerRequest ;
10
10
use Cake \TestSuite \TestCase ;
11
11
use TestApp \Controller \Component \TestAuthUserComponent ;
12
+ use TinyAuth \Controller \Component \AuthComponent ;
12
13
use TinyAuth \Utility \Cache ;
13
14
14
15
class AuthUserComponentTest extends TestCase {
@@ -29,10 +30,14 @@ class AuthUserComponentTest extends TestCase {
29
30
* @return void
30
31
*/
31
32
public function setUp (): void {
33
+ $ config = [
34
+ 'allowFilePath ' => ROOT . DS . 'tests ' . DS . 'test_files ' . DS ,
35
+ ];
36
+
32
37
$ controller = new Controller (new ServerRequest ());
33
38
$ componentRegistry = new ComponentRegistry ($ controller );
34
39
$ 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 ();
36
41
37
42
Configure::write ('Roles ' , [
38
43
'user ' => 1 ,
Original file line number Diff line number Diff line change 15
15
16
16
$ name = $ matches [1 ];
17
17
$ tableName = Inflector::underscore ($ name );
18
- $ class = 'Shim \\Test \\Fixture \\' . $ name . 'Fixture ' ;
18
+ $ class = 'TinyAuth \\Test \\Fixture \\' . $ name . 'Fixture ' ;
19
19
try {
20
20
$ object = (new ReflectionClass ($ class ))->getProperty ('fields ' );
21
21
} catch (ReflectionException $ e ) {
You can’t perform that action at this time.
0 commit comments