@@ -32,25 +32,6 @@ public function testGame()
32
32
$ this ->assertNotNull ($ g ->getLogger ());
33
33
}
34
34
35
- public function testWorkingFromChildWorkingDirectory ()
36
- {
37
- $ cwd = getcwd ();
38
- $ oldconf = getenv ("LOTGD_CONFIG " );
39
- chdir ($ cwd . "/tests/ " );
40
- putenv ("LOTGD_CONFIG=../ " .$ oldconf );
41
-
42
- $ this ->assertStringEndsWith ("/tests " , getcwd ());
43
- $ this ->assertStringStartsWith (".././ " , getenv ("LOTGD_CONFIG " ));
44
-
45
- $ game = Bootstrap::createGame ();
46
-
47
- chdir ($ cwd );
48
- putenv ("LOTGD_CONFIG= " . $ oldconf );
49
-
50
- $ this ->assertStringEndsNotWith ("/tests " , getcwd ());
51
- $ this ->assertStringStartsNotWith (".././ " , getenv ("LOTGD_CONFIG " ));
52
- }
53
-
54
35
public function testBootstrapLoadsPackageModels ()
55
36
{
56
37
$ installationManager = $ this ->getMockBuilder (InstallationManager::class)
@@ -61,27 +42,31 @@ public function testBootstrapLoadsPackageModels()
61
42
62
43
$ composer = $ this ->getMockBuilder (\Composer \Composer::class)
63
44
->disableOriginalConstructor ()
64
- ->setMethods (["getInstallationManager " , " translateNamespaceToPath " ])
45
+ ->setMethods (["getInstallationManager " ])
65
46
->getMock ();
66
47
$ composer ->method ("getInstallationManager " )->willReturn ($ installationManager );
67
- $ composer
68
- ->expects ($ this ->exactly (1 ))
69
- ->method ("translateNamespaceToPath " )
70
- ->with ("LotGD \\Core \\Tests \\FakeModule \\Models " )
71
- ->willReturn (__DIR__ . "/FakeModule/Models " );
72
48
73
49
$ fakeModulePackage = $ this ->getMockBuilder (AliasPackage::class)
74
50
->disableOriginalConstructor ()
75
- ->setMethods (["getType " , "getExtra " ])
51
+ ->setMethods (["getType " , "getAutoload " ])
76
52
->getMock ();
77
53
$ fakeModulePackage ->method ("getType " )->willReturn ("lotgd-module " );
78
- $ fakeModulePackage ->method ("getExtra " )->willReturn (["lotgd-namespace " => "LotGD \\Core \\Tests \\FakeModule \\" ]);
54
+ $ fakeModulePackage ->method ("getAutoload " )->willReturn ([
55
+ "psr-4 " => [
56
+ "LotGD \\Core \\Tests \\FakeModule \\" => "FakeModule/ "
57
+ ]
58
+ ]);
79
59
80
60
$ composerManager = $ this ->getMockBuilder (ComposerManager::class)
81
- ->setMethods (["getPackages " , "getComposer " ])
61
+ ->setMethods (["getPackages " , "getComposer " , " translateNamespaceToPath " ])
82
62
->getMock ();
83
63
$ composerManager ->method ("getPackages " )->willReturn ([$ fakeModulePackage ]);
84
64
$ composerManager ->method ("getComposer " )->willReturn ($ composer );
65
+ $ composerManager
66
+ ->expects ($ this ->exactly (1 ))
67
+ ->method ("translateNamespaceToPath " )
68
+ ->with ("LotGD \\Core \\Tests \\FakeModule \\Models " )
69
+ ->willReturn (__DIR__ . "/FakeModule/Models " );
85
70
86
71
$ bootstrap = $ this ->getMockBuilder (Bootstrap::class)
87
72
->setMethods (["createComposerManager " ])
@@ -93,42 +78,6 @@ public function testBootstrapLoadsPackageModels()
93
78
94
79
$ this ->assertGreaterThanorEqual (3 , $ bootstrap ->getReadAnnotationDirectories ());
95
80
96
- /*$user = new UserEntity();
97
- $user->setName("Monthy");
98
- $game->getEntityManager()->persist($user);
99
- $game->getEntityManager()->flush();
100
- $id = $user->getId();
101
- $this->assertInternalType("int", $id);
102
- $game->getEntityManager()->clear();
103
- $user = $game->getEntityManager()->getRepository(UserEntity::class)->find($id);
104
- $this->assertInternalType("int", $user->getId());
105
- $this->assertInternalType("string", $user->getName());
106
- $this->assertSame("Monthy", $user->getName());*/
107
- }
108
-
109
- /*public function testGenerateAnnotationDirectories()
110
- {
111
- $composerManager = $this->getMockBuilder(ComposerManager::class)
112
- ->disableOriginalConstructor()
113
- ->getMock();
114
-
115
- $package = $this->getMockForAbstractClass(PackageInterface::class);
116
- $package->method('getName')->willReturn('lotgd/BootstrapTest');
117
- $package->method('getExtra')->willReturn(array(
118
- 'lotgd-namespace' => 'LotGD\\Core\\Tests\\FakeModule\\',
119
- ));
120
- $composerManager->method('getPackages')->willReturn(array($package));
121
-
122
- $bootstrap = $this->getMockBuilder(Bootstrap::class)
123
- ->setMethods(["createComposerManager"])
124
- ->getMock();
125
-
126
- $bootstrap->method("createComposerManager")->willReturn($composerManager);
127
-
128
- $game = $bootstrap->getGame();
129
-
130
- $this->assertGreaterThanOrEqual(2, $bootstrap->getReadAnnotationDirectories());
131
-
132
81
$ user = new UserEntity ();
133
82
$ user ->setName ("Monthy " );
134
83
$ game ->getEntityManager ()->persist ($ user );
@@ -140,5 +89,5 @@ public function testBootstrapLoadsPackageModels()
140
89
$ this ->assertInternalType ("int " , $ user ->getId ());
141
90
$ this ->assertInternalType ("string " , $ user ->getName ());
142
91
$ this ->assertSame ("Monthy " , $ user ->getName ());
143
- }*/
92
+ }
144
93
}
0 commit comments