@@ -35,7 +35,7 @@ |
||
35 | 35 | */ |
36 | 36 | const HELP = <<<HELP |
37 | 37 | Installs, into the Moodle installation in the present working directory, all of the components listed in its componentmgr.json file. |
38 | -HELP; |
|
38 | +help; |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * Initialiser. |
@@ -31,6 +31,7 @@ |
||
31 | 31 | * @param HttpClient $httpClient |
32 | 32 | * @param \ComponentManager\Platform\Platform $platform |
33 | 33 | * @param \stdClass $options |
34 | + * @return void |
|
34 | 35 | */ |
35 | 36 | public function __construct(Filesystem $filesystem, HttpClient $httpClient, |
36 | 37 | Platform $platform, stdClass $options); |
@@ -14,8 +14,8 @@ |
||
14 | 14 | use ComponentManager\ComponentVersion; |
15 | 15 | use ComponentManager\HttpClient; |
16 | 16 | use ComponentManager\Platform\Platform; |
17 | -use stdClass; |
|
18 | 17 | use Symfony\Component\Filesystem\Filesystem; |
18 | +use stdClass; |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * Package repository interface. |
@@ -79,7 +79,7 @@ |
||
79 | 79 | * @return RequestInterface |
80 | 80 | */ |
81 | 81 | public function createRequest($method, $uri, $headers=[], $body=null, |
82 | - $protocolVersion='1.1') { |
|
82 | + $protocolVersion='1.1') { |
|
83 | 83 | return $this->messageFactory->createRequest( |
84 | 84 | $method, $uri, $headers, $body, $protocolVersion); |
85 | 85 | } |
@@ -78,8 +78,8 @@ |
||
78 | 78 | * |
79 | 79 | * @return RequestInterface |
80 | 80 | */ |
81 | - public function createRequest($method, $uri, $headers=[], $body=null, |
|
82 | - $protocolVersion='1.1') { |
|
81 | + public function createRequest($method, $uri, $headers = [], $body = null, |
|
82 | + $protocolVersion = '1.1') { |
|
83 | 83 | return $this->messageFactory->createRequest( |
84 | 84 | $method, $uri, $headers, $body, $protocolVersion); |
85 | 85 | } |
@@ -20,33 +20,33 @@ |
||
20 | 20 | * @coversDefaultClass \ComponentManager\Component |
21 | 21 | */ |
22 | 22 | class ComponentTest extends TestCase { |
23 | - public function testGetNameParts() { |
|
24 | - $component = new Component('type_name', []); |
|
25 | - $this->assertEquals(['type', 'name'], $component->getNameParts()); |
|
26 | - $this->assertEquals('type', $component->getPluginType()); |
|
27 | - $this->assertEquals('name', $component->getPluginName()); |
|
28 | - } |
|
29 | - |
|
30 | - public function testGetVersion() { |
|
31 | - $goodPackageRepository = $this->createMock(PackageRepository::class); |
|
32 | - $goodPackageRepository->method('satisfiesVersion') |
|
33 | - ->willReturn(true); |
|
34 | - $badPackageRepository = $this->createMock(PackageRepository::class); |
|
35 | - $badPackageRepository->method('satisfiesVersion') |
|
36 | - ->willReturn(false); |
|
37 | - |
|
38 | - $componentVersion = new ComponentVersion( |
|
23 | + public function testGetNameParts() { |
|
24 | + $component = new Component('type_name', []); |
|
25 | + $this->assertEquals(['type', 'name'], $component->getNameParts()); |
|
26 | + $this->assertEquals('type', $component->getPluginType()); |
|
27 | + $this->assertEquals('name', $component->getPluginName()); |
|
28 | + } |
|
29 | + |
|
30 | + public function testGetVersion() { |
|
31 | + $goodPackageRepository = $this->createMock(PackageRepository::class); |
|
32 | + $goodPackageRepository->method('satisfiesVersion') |
|
33 | + ->willReturn(true); |
|
34 | + $badPackageRepository = $this->createMock(PackageRepository::class); |
|
35 | + $badPackageRepository->method('satisfiesVersion') |
|
36 | + ->willReturn(false); |
|
37 | + |
|
38 | + $componentVersion = new ComponentVersion( |
|
39 | 39 | '2015021800', 'Genesis', ComponentVersion::MATURITY_STABLE, []); |
40 | 40 | |
41 | - $component = new Component( |
|
41 | + $component = new Component( |
|
42 | 42 | 'type_name', [$componentVersion], $goodPackageRepository); |
43 | - $this->assertEquals( |
|
43 | + $this->assertEquals( |
|
44 | 44 | $componentVersion, $component->getVersion('2015021800')); |
45 | 45 | |
46 | - $this->expectException(UnsatisfiedVersionException::class); |
|
47 | - $this->expectExceptionCode(UnsatisfiedVersionException::CODE_UNKNOWN_VERSION); |
|
48 | - $component = new Component( |
|
46 | + $this->expectException(UnsatisfiedVersionException::class); |
|
47 | + $this->expectExceptionCode(UnsatisfiedVersionException::CODE_UNKNOWN_VERSION); |
|
48 | + $component = new Component( |
|
49 | 49 | 'type_name', [$componentVersion], $badPackageRepository); |
50 | - $component->getVersion('2015021800'); |
|
51 | - } |
|
50 | + $component->getVersion('2015021800'); |
|
51 | + } |
|
52 | 52 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * |
86 | 86 | * @throws VersionControlException |
87 | 87 | */ |
88 | - public function runCommand(Command $command, $exceptionCode=null) { |
|
88 | + public function runCommand(Command $command, $exceptionCode = null) { |
|
89 | 89 | $process = $this->createProcess($command->getCommandLine()); |
90 | 90 | $process->run(); |
91 | 91 | |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | * |
160 | 160 | * @codeCoverageIgnore |
161 | 161 | */ |
162 | - public function fetch($remote=null) { |
|
162 | + public function fetch($remote = null) { |
|
163 | 163 | $command = new FetchCommand($remote); |
164 | 164 | return $this->runCommand( |
165 | 165 | $command, VersionControlException::CODE_FETCH_FAILED); |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | * |
177 | 177 | * @codeCoverageIgnore |
178 | 178 | */ |
179 | - public function fetchTags($remote=null) { |
|
179 | + public function fetchTags($remote = null) { |
|
180 | 180 | $command = new FetchCommand($remote); |
181 | 181 | $command->setTags(true); |
182 | 182 | return $this->runCommand( |
@@ -33,7 +33,7 @@ |
||
33 | 33 | * |
34 | 34 | * @param string|null $remote |
35 | 35 | */ |
36 | - public function __construct($remote=null) { |
|
36 | + public function __construct($remote = null) { |
|
37 | 37 | $this->remote = $remote; |
38 | 38 | } |
39 | 39 |