1 | <?php |
||
20 | * @coversDefaultClass \ComponentManager\Component |
||
21 | */ |
||
22 | class ComponentTest extends TestCase { |
||
23 | public function testGetNameParts() { |
||
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 | '2015021800', 'Genesis', ComponentVersion::MATURITY_STABLE, []); |
||
40 | |||
41 | $component = new Component( |
||
42 | 'type_name', [$componentVersion], $goodPackageRepository); |
||
43 | $this->assertEquals( |
||
44 | $componentVersion, $component->getVersion('2015021800')); |
||
45 | |||
46 | $this->expectException(UnsatisfiedVersionException::class); |
||
47 | $this->expectExceptionCode(UnsatisfiedVersionException::CODE_UNKNOWN_VERSION); |
||
|
|||
48 | $component = new Component( |
||
49 | 'type_name', [$componentVersion], $badPackageRepository); |
||
50 | $component->getVersion('2015021800'); |
||
51 | } |
||
53 |
Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.