These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace BringYourOwnIdeas\UpdateChecker\Tests; |
||
4 | |||
5 | use BringYourOwnIdeas\UpdateChecker\UpdateChecker; |
||
6 | use Composer\Composer; |
||
7 | use Composer\Package\RootPackage; |
||
8 | use Injector; |
||
9 | use Package; |
||
10 | use PHPUnit_Framework_TestCase; |
||
11 | use SapphireTest; |
||
12 | |||
13 | /** |
||
14 | * @mixin PHPUnit_Framework_TestCase |
||
15 | */ |
||
16 | class UpdateCheckerTest extends SapphireTest |
||
17 | { |
||
18 | protected $usesDatabase = true; |
||
19 | |||
20 | public function testAvailableUpdatesAreWrittenToPackageModel() |
||
21 | { |
||
22 | // Mock Composer |
||
23 | $composerMock = $this->getMock(Composer::class); |
||
0 ignored issues
–
show
|
|||
24 | Injector::inst()->registerService($composerMock, Composer::class); |
||
25 | |||
26 | // Create mock package |
||
27 | $packageMock = $this->getMockBuilder(RootPackage::class) |
||
0 ignored issues
–
show
The method
getMockBuilder() does not seem to exist on object<BringYourOwnIdeas...ests\UpdateCheckerTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed.
Loading history...
|
|||
28 | ->disableOriginalConstructor() |
||
29 | ->setMethods(['getName', 'getPrettyVersion', 'getSourceReference']) |
||
30 | ->getMock(); |
||
31 | $packageMock->expects($this->once()) |
||
0 ignored issues
–
show
The method
once() does not seem to exist on object<BringYourOwnIdeas...ests\UpdateCheckerTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed.
Loading history...
|
|||
32 | ->method('getName') |
||
33 | ->will($this->returnValue('foo/module')); |
||
0 ignored issues
–
show
The method
returnValue() does not seem to exist on object<BringYourOwnIdeas...ests\UpdateCheckerTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed.
Loading history...
|
|||
34 | $packageMock->expects($this->exactly(3)) |
||
0 ignored issues
–
show
The method
exactly() does not seem to exist on object<BringYourOwnIdeas...ests\UpdateCheckerTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed.
Loading history...
|
|||
35 | ->method('getPrettyVersion') |
||
36 | ->will($this->onConsecutiveCalls('1.2.0', '1.2.3', '2.3.4')); |
||
0 ignored issues
–
show
The method
onConsecutiveCalls() does not seem to exist on object<BringYourOwnIdeas...ests\UpdateCheckerTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed.
Loading history...
|
|||
37 | $packageMock->expects($this->exactly(3)) |
||
0 ignored issues
–
show
The method
exactly() does not seem to exist on object<BringYourOwnIdeas...ests\UpdateCheckerTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed.
Loading history...
|
|||
38 | ->method('getSourceReference') |
||
39 | ->will($this->onConsecutiveCalls('1a2s3d4f', '8s7d6f5g', '9g8f7d6s')); |
||
0 ignored issues
–
show
The method
onConsecutiveCalls() does not seem to exist on object<BringYourOwnIdeas...ests\UpdateCheckerTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed.
Loading history...
|
|||
40 | |||
41 | // Partially mock the update checker |
||
42 | $checker = $this->getMockBuilder(UpdateChecker::class)->setMethods(['findLatestPackage'])->getMock(); |
||
0 ignored issues
–
show
The method
getMockBuilder() does not seem to exist on object<BringYourOwnIdeas...ests\UpdateCheckerTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed.
Loading history...
|
|||
43 | $checker->expects($this->exactly(2)) |
||
0 ignored issues
–
show
The method
exactly() does not seem to exist on object<BringYourOwnIdeas...ests\UpdateCheckerTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed.
Loading history...
|
|||
44 | ->method('findLatestPackage') |
||
45 | ->will($this->returnValue($packageMock)); |
||
0 ignored issues
–
show
The method
returnValue() does not seem to exist on object<BringYourOwnIdeas...ests\UpdateCheckerTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed.
Loading history...
|
|||
46 | |||
47 | // Run the checker |
||
48 | $checker->checkForUpdates($packageMock, '~1.2'); |
||
49 | |||
50 | // Check the database for results |
||
51 | $module = Package::get()->filter(['Name' => 'foo/module'])->first(); |
||
52 | $this->assertNotEmpty($module); |
||
0 ignored issues
–
show
The method
assertNotEmpty() does not seem to exist on object<BringYourOwnIdeas...ests\UpdateCheckerTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed.
Loading history...
|
|||
53 | |||
54 | $this->assertSame('1a2s3d4f', $module->VersionHash, 'The current hash is recorded'); |
||
0 ignored issues
–
show
The method
assertSame() does not seem to exist on object<BringYourOwnIdeas...ests\UpdateCheckerTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed.
Loading history...
|
|||
55 | $this->assertSame('8s7d6f5g', $module->AvailableHash, 'The next available hash is recorded'); |
||
0 ignored issues
–
show
The method
assertSame() does not seem to exist on object<BringYourOwnIdeas...ests\UpdateCheckerTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed.
Loading history...
|
|||
56 | $this->assertSame('9g8f7d6s', $module->LatestHash, 'The latest available hash is recorded'); |
||
0 ignored issues
–
show
The method
assertSame() does not seem to exist on object<BringYourOwnIdeas...ests\UpdateCheckerTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed.
Loading history...
|
|||
57 | |||
58 | $this->assertSame('1.2.0', $module->Version, 'The current version is recorded'); |
||
0 ignored issues
–
show
The method
assertSame() does not seem to exist on object<BringYourOwnIdeas...ests\UpdateCheckerTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed.
Loading history...
|
|||
59 | $this->assertSame('1.2.3', $module->AvailableVersion, 'The available version is recorded'); |
||
0 ignored issues
–
show
The method
assertSame() does not seem to exist on object<BringYourOwnIdeas...ests\UpdateCheckerTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed.
Loading history...
|
|||
60 | $this->assertSame('2.3.4', $module->LatestVersion, 'The latest available version is recorded'); |
||
0 ignored issues
–
show
The method
assertSame() does not seem to exist on object<BringYourOwnIdeas...ests\UpdateCheckerTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed.
Loading history...
|
|||
61 | |||
62 | $this->assertSame('~1.2', $module->VersionConstraint, 'The installation constraint is recorded'); |
||
0 ignored issues
–
show
The method
assertSame() does not seem to exist on object<BringYourOwnIdeas...ests\UpdateCheckerTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed.
Loading history...
|
|||
63 | } |
||
64 | } |
||
65 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.