@@ -125,19 +125,19 @@ discard block |
||
| 125 | 125 | public function requirementsProvider(): array |
| 126 | 126 | { |
| 127 | 127 | return [ |
| 128 | - ['testOne', []], |
|
| 129 | - ['testTwo', ['PHPUnit' => ['version' => '1.0', 'operator' => '']]], |
|
| 130 | - ['testThree', ['PHP' => ['version' => '2.0', 'operator' => '']]], |
|
| 131 | - ['testFour', [ |
|
| 128 | + ['testOne', []], |
|
| 129 | + ['testTwo', ['PHPUnit' => ['version' => '1.0', 'operator' => '']]], |
|
| 130 | + ['testThree', ['PHP' => ['version' => '2.0', 'operator' => '']]], |
|
| 131 | + ['testFour', [ |
|
| 132 | 132 | 'PHPUnit' => ['version' => '2.0', 'operator' => ''], |
| 133 | 133 | 'PHP' => ['version' => '1.0', 'operator' => ''], |
| 134 | 134 | ]], |
| 135 | - ['testFive', ['PHP' => ['version' => '5.4.0RC6', 'operator' => '']]], |
|
| 136 | - ['testSix', ['PHP' => ['version' => '5.4.0-alpha1', 'operator' => '']]], |
|
| 137 | - ['testSeven', ['PHP' => ['version' => '5.4.0beta2', 'operator' => '']]], |
|
| 138 | - ['testEight', ['PHP' => ['version' => '5.4-dev', 'operator' => '']]], |
|
| 139 | - ['testNine', ['functions' => ['testFunc']]], |
|
| 140 | - ['testTen', ['extensions' => ['testExt']]], |
|
| 135 | + ['testFive', ['PHP' => ['version' => '5.4.0RC6', 'operator' => '']]], |
|
| 136 | + ['testSix', ['PHP' => ['version' => '5.4.0-alpha1', 'operator' => '']]], |
|
| 137 | + ['testSeven', ['PHP' => ['version' => '5.4.0beta2', 'operator' => '']]], |
|
| 138 | + ['testEight', ['PHP' => ['version' => '5.4-dev', 'operator' => '']]], |
|
| 139 | + ['testNine', ['functions' => ['testFunc']]], |
|
| 140 | + ['testTen', ['extensions' => ['testExt']]], |
|
| 141 | 141 | ['testEleven', [ |
| 142 | 142 | 'OS' => 'SunOS', |
| 143 | 143 | 'OSFAMILY' => 'Solaris', |
@@ -515,12 +515,12 @@ discard block |
||
| 515 | 515 | public function missingRequirementsProvider(): array |
| 516 | 516 | { |
| 517 | 517 | return [ |
| 518 | - ['testOne', []], |
|
| 519 | - ['testNine', ['Function testFunc is required.']], |
|
| 520 | - ['testTen', ['Extension testExt is required.']], |
|
| 521 | - ['testAlwaysSkip', ['PHPUnit >= 1111111 is required.']], |
|
| 522 | - ['testAlwaysSkip2', ['PHP >= 9999999 is required.']], |
|
| 523 | - ['testAlwaysSkip3', ['Operating system matching /DOESNOTEXIST/i is required.']], |
|
| 518 | + ['testOne', []], |
|
| 519 | + ['testNine', ['Function testFunc is required.']], |
|
| 520 | + ['testTen', ['Extension testExt is required.']], |
|
| 521 | + ['testAlwaysSkip', ['PHPUnit >= 1111111 is required.']], |
|
| 522 | + ['testAlwaysSkip2', ['PHP >= 9999999 is required.']], |
|
| 523 | + ['testAlwaysSkip3', ['Operating system matching /DOESNOTEXIST/i is required.']], |
|
| 524 | 524 | ['testAllPossibleRequirements', [ |
| 525 | 525 | 'PHP >= 99-dev is required.', |
| 526 | 526 | 'PHPUnit >= 9-dev is required.', |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | public function testExceptionInSetUp(): void |
| 120 | 120 | { |
| 121 | - $test = new \ExceptionInSetUpTest('testSomething'); |
|
| 121 | + $test = new \ExceptionInSetUpTest('testSomething'); |
|
| 122 | 122 | $test->run(); |
| 123 | 123 | |
| 124 | 124 | $this->assertTrue($test->setUp); |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | |
| 131 | 131 | public function testExceptionInAssertPreConditions(): void |
| 132 | 132 | { |
| 133 | - $test = new \ExceptionInAssertPreConditionsTest('testSomething'); |
|
| 133 | + $test = new \ExceptionInAssertPreConditionsTest('testSomething'); |
|
| 134 | 134 | $test->run(); |
| 135 | 135 | |
| 136 | 136 | $this->assertTrue($test->setUp); |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | |
| 143 | 143 | public function testExceptionInTest(): void |
| 144 | 144 | { |
| 145 | - $test = new \ExceptionInTest('testSomething'); |
|
| 145 | + $test = new \ExceptionInTest('testSomething'); |
|
| 146 | 146 | $test->run(); |
| 147 | 147 | |
| 148 | 148 | $this->assertTrue($test->setUp); |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | |
| 155 | 155 | public function testExceptionInAssertPostConditions(): void |
| 156 | 156 | { |
| 157 | - $test = new \ExceptionInAssertPostConditionsTest('testSomething'); |
|
| 157 | + $test = new \ExceptionInAssertPostConditionsTest('testSomething'); |
|
| 158 | 158 | $test->run(); |
| 159 | 159 | |
| 160 | 160 | $this->assertTrue($test->setUp); |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | |
| 167 | 167 | public function testExceptionInTearDown(): void |
| 168 | 168 | { |
| 169 | - $test = new \ExceptionInTearDownTest('testSomething'); |
|
| 169 | + $test = new \ExceptionInTearDownTest('testSomething'); |
|
| 170 | 170 | $test->run(); |
| 171 | 171 | |
| 172 | 172 | $this->assertTrue($test->setUp); |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | |
| 181 | 181 | public function testExceptionInTestIsDetectedInTeardown(): void |
| 182 | 182 | { |
| 183 | - $test = new \ExceptionInTestDetectedInTeardown('testSomething'); |
|
| 183 | + $test = new \ExceptionInTestDetectedInTeardown('testSomething'); |
|
| 184 | 184 | $test->run(); |
| 185 | 185 | |
| 186 | 186 | $this->assertTrue($test->exceptionDetected); |
@@ -558,7 +558,7 @@ discard block |
||
| 558 | 558 | |
| 559 | 559 | public function testSkipsIfRequiresNonExistingExtension(): void |
| 560 | 560 | { |
| 561 | - $test = new \RequirementsTest('testTen'); |
|
| 561 | + $test = new \RequirementsTest('testTen'); |
|
| 562 | 562 | $test->run(); |
| 563 | 563 | |
| 564 | 564 | $this->assertEquals( |
@@ -569,7 +569,7 @@ discard block |
||
| 569 | 569 | |
| 570 | 570 | public function testSkipsIfRequiresExtensionWithAMinimumVersion(): void |
| 571 | 571 | { |
| 572 | - $test = new \RequirementsTest('testSpecificExtensionVersion'); |
|
| 572 | + $test = new \RequirementsTest('testSpecificExtensionVersion'); |
|
| 573 | 573 | $test->run(); |
| 574 | 574 | |
| 575 | 575 | $this->assertEquals( |
@@ -580,7 +580,7 @@ discard block |
||
| 580 | 580 | |
| 581 | 581 | public function testSkipsProvidesMessagesForAllSkippingReasons(): void |
| 582 | 582 | { |
| 583 | - $test = new \RequirementsTest('testAllPossibleRequirements'); |
|
| 583 | + $test = new \RequirementsTest('testAllPossibleRequirements'); |
|
| 584 | 584 | $test->run(); |
| 585 | 585 | |
| 586 | 586 | $this->assertEquals( |
@@ -627,7 +627,7 @@ discard block |
||
| 627 | 627 | |
| 628 | 628 | public function testRequiringASetting(): void |
| 629 | 629 | { |
| 630 | - $test = new \RequirementsTest('testSettingDisplayErrorsOn'); |
|
| 630 | + $test = new \RequirementsTest('testSettingDisplayErrorsOn'); |
|
| 631 | 631 | |
| 632 | 632 | // Get this so we can return it to whatever it was before the test. |
| 633 | 633 | $displayErrorsVal = \ini_get('display_errors'); |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | //Stop |
| 56 | 56 | $result->stopOnIncomplete(true); |
| 57 | 57 | $result->addError($test, $throwable, $time); |
| 58 | - $this->assertAttributeEquals(2 * $time, 'time', $result); |
|
| 58 | + $this->assertAttributeEquals(2*$time, 'time', $result); |
|
| 59 | 59 | $this->assertAttributeCount(2, 'notImplemented', $result); |
| 60 | 60 | $this->assertAttributeEquals(true, 'stop', $result); |
| 61 | 61 | //Final checks |
@@ -17,20 +17,20 @@ discard block |
||
| 17 | 17 | public function testMockedMethodIsNeverCalled(): void |
| 18 | 18 | { |
| 19 | 19 | $mock = $this->getMockBuilder(AnInterface::class) |
| 20 | - ->getMock(); |
|
| 20 | + ->getMock(); |
|
| 21 | 21 | |
| 22 | 22 | $mock->expects($this->never()) |
| 23 | - ->method('doSomething'); |
|
| 23 | + ->method('doSomething'); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | public function testMockedMethodIsNeverCalledWithParameter(): void |
| 27 | 27 | { |
| 28 | 28 | $mock = $this->getMockBuilder(SomeClass::class) |
| 29 | - ->getMock(); |
|
| 29 | + ->getMock(); |
|
| 30 | 30 | |
| 31 | 31 | $mock->expects($this->never()) |
| 32 | - ->method('doSomething') |
|
| 33 | - ->with('someArg'); |
|
| 32 | + ->method('doSomething') |
|
| 33 | + ->with('someArg'); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | /** |
@@ -39,11 +39,11 @@ discard block |
||
| 39 | 39 | public function testMockedMethodIsNotCalledWhenExpectsAnyWithParameter(): void |
| 40 | 40 | { |
| 41 | 41 | $mock = $this->getMockBuilder(SomeClass::class) |
| 42 | - ->getMock(); |
|
| 42 | + ->getMock(); |
|
| 43 | 43 | |
| 44 | 44 | $mock->expects($this->any()) |
| 45 | - ->method('doSomethingElse') |
|
| 46 | - ->with('someArg'); |
|
| 45 | + ->method('doSomethingElse') |
|
| 46 | + ->with('someArg'); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
@@ -52,19 +52,19 @@ discard block |
||
| 52 | 52 | public function testMockedMethodIsNotCalledWhenMethodSpecifiedDirectlyWithParameter(): void |
| 53 | 53 | { |
| 54 | 54 | $mock = $this->getMockBuilder(SomeClass::class) |
| 55 | - ->getMock(); |
|
| 55 | + ->getMock(); |
|
| 56 | 56 | |
| 57 | 57 | $mock->method('doSomethingElse') |
| 58 | - ->with('someArg'); |
|
| 58 | + ->with('someArg'); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | public function testMockedMethodIsCalledAtLeastOnce(): void |
| 62 | 62 | { |
| 63 | 63 | $mock = $this->getMockBuilder(AnInterface::class) |
| 64 | - ->getMock(); |
|
| 64 | + ->getMock(); |
|
| 65 | 65 | |
| 66 | 66 | $mock->expects($this->atLeastOnce()) |
| 67 | - ->method('doSomething'); |
|
| 67 | + ->method('doSomething'); |
|
| 68 | 68 | |
| 69 | 69 | $mock->doSomething(); |
| 70 | 70 | } |
@@ -72,10 +72,10 @@ discard block |
||
| 72 | 72 | public function testMockedMethodIsCalledAtLeastOnce2(): void |
| 73 | 73 | { |
| 74 | 74 | $mock = $this->getMockBuilder(AnInterface::class) |
| 75 | - ->getMock(); |
|
| 75 | + ->getMock(); |
|
| 76 | 76 | |
| 77 | 77 | $mock->expects($this->atLeastOnce()) |
| 78 | - ->method('doSomething'); |
|
| 78 | + ->method('doSomething'); |
|
| 79 | 79 | |
| 80 | 80 | $mock->doSomething(); |
| 81 | 81 | $mock->doSomething(); |
@@ -84,10 +84,10 @@ discard block |
||
| 84 | 84 | public function testMockedMethodIsCalledAtLeastTwice(): void |
| 85 | 85 | { |
| 86 | 86 | $mock = $this->getMockBuilder(AnInterface::class) |
| 87 | - ->getMock(); |
|
| 87 | + ->getMock(); |
|
| 88 | 88 | |
| 89 | 89 | $mock->expects($this->atLeast(2)) |
| 90 | - ->method('doSomething'); |
|
| 90 | + ->method('doSomething'); |
|
| 91 | 91 | |
| 92 | 92 | $mock->doSomething(); |
| 93 | 93 | $mock->doSomething(); |
@@ -96,10 +96,10 @@ discard block |
||
| 96 | 96 | public function testMockedMethodIsCalledAtLeastTwice2(): void |
| 97 | 97 | { |
| 98 | 98 | $mock = $this->getMockBuilder(AnInterface::class) |
| 99 | - ->getMock(); |
|
| 99 | + ->getMock(); |
|
| 100 | 100 | |
| 101 | 101 | $mock->expects($this->atLeast(2)) |
| 102 | - ->method('doSomething'); |
|
| 102 | + ->method('doSomething'); |
|
| 103 | 103 | |
| 104 | 104 | $mock->doSomething(); |
| 105 | 105 | $mock->doSomething(); |
@@ -109,10 +109,10 @@ discard block |
||
| 109 | 109 | public function testMockedMethodIsCalledAtMostTwice(): void |
| 110 | 110 | { |
| 111 | 111 | $mock = $this->getMockBuilder(AnInterface::class) |
| 112 | - ->getMock(); |
|
| 112 | + ->getMock(); |
|
| 113 | 113 | |
| 114 | 114 | $mock->expects($this->atMost(2)) |
| 115 | - ->method('doSomething'); |
|
| 115 | + ->method('doSomething'); |
|
| 116 | 116 | |
| 117 | 117 | $mock->doSomething(); |
| 118 | 118 | $mock->doSomething(); |
@@ -121,10 +121,10 @@ discard block |
||
| 121 | 121 | public function testMockedMethodIsCalledAtMosttTwice2(): void |
| 122 | 122 | { |
| 123 | 123 | $mock = $this->getMockBuilder(AnInterface::class) |
| 124 | - ->getMock(); |
|
| 124 | + ->getMock(); |
|
| 125 | 125 | |
| 126 | 126 | $mock->expects($this->atMost(2)) |
| 127 | - ->method('doSomething'); |
|
| 127 | + ->method('doSomething'); |
|
| 128 | 128 | |
| 129 | 129 | $mock->doSomething(); |
| 130 | 130 | } |
@@ -132,10 +132,10 @@ discard block |
||
| 132 | 132 | public function testMockedMethodIsCalledOnce(): void |
| 133 | 133 | { |
| 134 | 134 | $mock = $this->getMockBuilder(AnInterface::class) |
| 135 | - ->getMock(); |
|
| 135 | + ->getMock(); |
|
| 136 | 136 | |
| 137 | 137 | $mock->expects($this->once()) |
| 138 | - ->method('doSomething'); |
|
| 138 | + ->method('doSomething'); |
|
| 139 | 139 | |
| 140 | 140 | $mock->doSomething(); |
| 141 | 141 | } |
@@ -143,11 +143,11 @@ discard block |
||
| 143 | 143 | public function testMockedMethodIsCalledOnceWithParameter(): void |
| 144 | 144 | { |
| 145 | 145 | $mock = $this->getMockBuilder(SomeClass::class) |
| 146 | - ->getMock(); |
|
| 146 | + ->getMock(); |
|
| 147 | 147 | |
| 148 | 148 | $mock->expects($this->once()) |
| 149 | - ->method('doSomethingElse') |
|
| 150 | - ->with($this->equalTo('something')); |
|
| 149 | + ->method('doSomethingElse') |
|
| 150 | + ->with($this->equalTo('something')); |
|
| 151 | 151 | |
| 152 | 152 | $mock->doSomethingElse('something'); |
| 153 | 153 | } |
@@ -155,10 +155,10 @@ discard block |
||
| 155 | 155 | public function testMockedMethodIsCalledExactly(): void |
| 156 | 156 | { |
| 157 | 157 | $mock = $this->getMockBuilder(AnInterface::class) |
| 158 | - ->getMock(); |
|
| 158 | + ->getMock(); |
|
| 159 | 159 | |
| 160 | 160 | $mock->expects($this->exactly(2)) |
| 161 | - ->method('doSomething'); |
|
| 161 | + ->method('doSomething'); |
|
| 162 | 162 | |
| 163 | 163 | $mock->doSomething(); |
| 164 | 164 | $mock->doSomething(); |
@@ -167,11 +167,11 @@ discard block |
||
| 167 | 167 | public function testStubbedException(): void |
| 168 | 168 | { |
| 169 | 169 | $mock = $this->getMockBuilder(AnInterface::class) |
| 170 | - ->getMock(); |
|
| 170 | + ->getMock(); |
|
| 171 | 171 | |
| 172 | 172 | $mock->expects($this->any()) |
| 173 | - ->method('doSomething') |
|
| 174 | - ->will($this->throwException(new \Exception)); |
|
| 173 | + ->method('doSomething') |
|
| 174 | + ->will($this->throwException(new \Exception)); |
|
| 175 | 175 | |
| 176 | 176 | $this->expectException(\Exception::class); |
| 177 | 177 | |
@@ -181,11 +181,11 @@ discard block |
||
| 181 | 181 | public function testStubbedWillThrowException(): void |
| 182 | 182 | { |
| 183 | 183 | $mock = $this->getMockBuilder(AnInterface::class) |
| 184 | - ->getMock(); |
|
| 184 | + ->getMock(); |
|
| 185 | 185 | |
| 186 | 186 | $mock->expects($this->any()) |
| 187 | - ->method('doSomething') |
|
| 188 | - ->willThrowException(new \Exception); |
|
| 187 | + ->method('doSomething') |
|
| 188 | + ->willThrowException(new \Exception); |
|
| 189 | 189 | |
| 190 | 190 | $this->expectException(\Exception::class); |
| 191 | 191 | |
@@ -195,20 +195,20 @@ discard block |
||
| 195 | 195 | public function testStubbedReturnValue(): void |
| 196 | 196 | { |
| 197 | 197 | $mock = $this->getMockBuilder(AnInterface::class) |
| 198 | - ->getMock(); |
|
| 198 | + ->getMock(); |
|
| 199 | 199 | |
| 200 | 200 | $mock->expects($this->any()) |
| 201 | - ->method('doSomething') |
|
| 202 | - ->will($this->returnValue('something')); |
|
| 201 | + ->method('doSomething') |
|
| 202 | + ->will($this->returnValue('something')); |
|
| 203 | 203 | |
| 204 | 204 | $this->assertEquals('something', $mock->doSomething()); |
| 205 | 205 | |
| 206 | 206 | $mock = $this->getMockBuilder(AnInterface::class) |
| 207 | - ->getMock(); |
|
| 207 | + ->getMock(); |
|
| 208 | 208 | |
| 209 | 209 | $mock->expects($this->any()) |
| 210 | - ->method('doSomething') |
|
| 211 | - ->willReturn('something'); |
|
| 210 | + ->method('doSomething') |
|
| 211 | + ->willReturn('something'); |
|
| 212 | 212 | |
| 213 | 213 | $this->assertEquals('something', $mock->doSomething()); |
| 214 | 214 | } |
@@ -221,22 +221,22 @@ discard block |
||
| 221 | 221 | ]; |
| 222 | 222 | |
| 223 | 223 | $mock = $this->getMockBuilder(AnInterface::class) |
| 224 | - ->getMock(); |
|
| 224 | + ->getMock(); |
|
| 225 | 225 | |
| 226 | 226 | $mock->expects($this->any()) |
| 227 | - ->method('doSomething') |
|
| 228 | - ->will($this->returnValueMap($map)); |
|
| 227 | + ->method('doSomething') |
|
| 228 | + ->will($this->returnValueMap($map)); |
|
| 229 | 229 | |
| 230 | 230 | $this->assertEquals('d', $mock->doSomething('a', 'b', 'c')); |
| 231 | 231 | $this->assertEquals('h', $mock->doSomething('e', 'f', 'g')); |
| 232 | 232 | $this->assertNull($mock->doSomething('foo', 'bar')); |
| 233 | 233 | |
| 234 | 234 | $mock = $this->getMockBuilder(AnInterface::class) |
| 235 | - ->getMock(); |
|
| 235 | + ->getMock(); |
|
| 236 | 236 | |
| 237 | 237 | $mock->expects($this->any()) |
| 238 | - ->method('doSomething') |
|
| 239 | - ->willReturnMap($map); |
|
| 238 | + ->method('doSomething') |
|
| 239 | + ->willReturnMap($map); |
|
| 240 | 240 | |
| 241 | 241 | $this->assertEquals('d', $mock->doSomething('a', 'b', 'c')); |
| 242 | 242 | $this->assertEquals('h', $mock->doSomething('e', 'f', 'g')); |
@@ -246,20 +246,20 @@ discard block |
||
| 246 | 246 | public function testStubbedReturnArgument(): void |
| 247 | 247 | { |
| 248 | 248 | $mock = $this->getMockBuilder(AnInterface::class) |
| 249 | - ->getMock(); |
|
| 249 | + ->getMock(); |
|
| 250 | 250 | |
| 251 | 251 | $mock->expects($this->any()) |
| 252 | - ->method('doSomething') |
|
| 253 | - ->will($this->returnArgument(1)); |
|
| 252 | + ->method('doSomething') |
|
| 253 | + ->will($this->returnArgument(1)); |
|
| 254 | 254 | |
| 255 | 255 | $this->assertEquals('b', $mock->doSomething('a', 'b')); |
| 256 | 256 | |
| 257 | 257 | $mock = $this->getMockBuilder(AnInterface::class) |
| 258 | - ->getMock(); |
|
| 258 | + ->getMock(); |
|
| 259 | 259 | |
| 260 | 260 | $mock->expects($this->any()) |
| 261 | - ->method('doSomething') |
|
| 262 | - ->willReturnArgument(1); |
|
| 261 | + ->method('doSomething') |
|
| 262 | + ->willReturnArgument(1); |
|
| 263 | 263 | |
| 264 | 264 | $this->assertEquals('b', $mock->doSomething('a', 'b')); |
| 265 | 265 | } |
@@ -267,22 +267,22 @@ discard block |
||
| 267 | 267 | public function testFunctionCallback(): void |
| 268 | 268 | { |
| 269 | 269 | $mock = $this->getMockBuilder(SomeClass::class) |
| 270 | - ->setMethods(['doSomething']) |
|
| 271 | - ->getMock(); |
|
| 270 | + ->setMethods(['doSomething']) |
|
| 271 | + ->getMock(); |
|
| 272 | 272 | |
| 273 | 273 | $mock->expects($this->once()) |
| 274 | - ->method('doSomething') |
|
| 275 | - ->will($this->returnCallback('FunctionCallbackWrapper::functionCallback')); |
|
| 274 | + ->method('doSomething') |
|
| 275 | + ->will($this->returnCallback('FunctionCallbackWrapper::functionCallback')); |
|
| 276 | 276 | |
| 277 | 277 | $this->assertEquals('pass', $mock->doSomething('foo', 'bar')); |
| 278 | 278 | |
| 279 | 279 | $mock = $this->getMockBuilder(SomeClass::class) |
| 280 | - ->setMethods(['doSomething']) |
|
| 281 | - ->getMock(); |
|
| 280 | + ->setMethods(['doSomething']) |
|
| 281 | + ->getMock(); |
|
| 282 | 282 | |
| 283 | 283 | $mock->expects($this->once()) |
| 284 | - ->method('doSomething') |
|
| 285 | - ->willReturnCallback('FunctionCallbackWrapper::functionCallback'); |
|
| 284 | + ->method('doSomething') |
|
| 285 | + ->willReturnCallback('FunctionCallbackWrapper::functionCallback'); |
|
| 286 | 286 | |
| 287 | 287 | $this->assertEquals('pass', $mock->doSomething('foo', 'bar')); |
| 288 | 288 | } |
@@ -290,20 +290,20 @@ discard block |
||
| 290 | 290 | public function testStubbedReturnSelf(): void |
| 291 | 291 | { |
| 292 | 292 | $mock = $this->getMockBuilder(AnInterface::class) |
| 293 | - ->getMock(); |
|
| 293 | + ->getMock(); |
|
| 294 | 294 | |
| 295 | 295 | $mock->expects($this->any()) |
| 296 | - ->method('doSomething') |
|
| 297 | - ->will($this->returnSelf()); |
|
| 296 | + ->method('doSomething') |
|
| 297 | + ->will($this->returnSelf()); |
|
| 298 | 298 | |
| 299 | 299 | $this->assertEquals($mock, $mock->doSomething()); |
| 300 | 300 | |
| 301 | 301 | $mock = $this->getMockBuilder(AnInterface::class) |
| 302 | - ->getMock(); |
|
| 302 | + ->getMock(); |
|
| 303 | 303 | |
| 304 | 304 | $mock->expects($this->any()) |
| 305 | - ->method('doSomething') |
|
| 306 | - ->willReturnSelf(); |
|
| 305 | + ->method('doSomething') |
|
| 306 | + ->willReturnSelf(); |
|
| 307 | 307 | |
| 308 | 308 | $this->assertEquals($mock, $mock->doSomething()); |
| 309 | 309 | } |
@@ -311,22 +311,22 @@ discard block |
||
| 311 | 311 | public function testStubbedReturnOnConsecutiveCalls(): void |
| 312 | 312 | { |
| 313 | 313 | $mock = $this->getMockBuilder(AnInterface::class) |
| 314 | - ->getMock(); |
|
| 314 | + ->getMock(); |
|
| 315 | 315 | |
| 316 | 316 | $mock->expects($this->any()) |
| 317 | - ->method('doSomething') |
|
| 318 | - ->will($this->onConsecutiveCalls('a', 'b', 'c')); |
|
| 317 | + ->method('doSomething') |
|
| 318 | + ->will($this->onConsecutiveCalls('a', 'b', 'c')); |
|
| 319 | 319 | |
| 320 | 320 | $this->assertEquals('a', $mock->doSomething()); |
| 321 | 321 | $this->assertEquals('b', $mock->doSomething()); |
| 322 | 322 | $this->assertEquals('c', $mock->doSomething()); |
| 323 | 323 | |
| 324 | 324 | $mock = $this->getMockBuilder(AnInterface::class) |
| 325 | - ->getMock(); |
|
| 325 | + ->getMock(); |
|
| 326 | 326 | |
| 327 | 327 | $mock->expects($this->any()) |
| 328 | - ->method('doSomething') |
|
| 329 | - ->willReturnOnConsecutiveCalls('a', 'b', 'c'); |
|
| 328 | + ->method('doSomething') |
|
| 329 | + ->willReturnOnConsecutiveCalls('a', 'b', 'c'); |
|
| 330 | 330 | |
| 331 | 331 | $this->assertEquals('a', $mock->doSomething()); |
| 332 | 332 | $this->assertEquals('b', $mock->doSomething()); |
@@ -336,12 +336,12 @@ discard block |
||
| 336 | 336 | public function testStaticMethodCallback(): void |
| 337 | 337 | { |
| 338 | 338 | $mock = $this->getMockBuilder(SomeClass::class) |
| 339 | - ->setMethods(['doSomething']) |
|
| 340 | - ->getMock(); |
|
| 339 | + ->setMethods(['doSomething']) |
|
| 340 | + ->getMock(); |
|
| 341 | 341 | |
| 342 | 342 | $mock->expects($this->once()) |
| 343 | - ->method('doSomething') |
|
| 344 | - ->will($this->returnCallback(['MethodCallback', 'staticCallback'])); |
|
| 343 | + ->method('doSomething') |
|
| 344 | + ->will($this->returnCallback(['MethodCallback', 'staticCallback'])); |
|
| 345 | 345 | |
| 346 | 346 | $this->assertEquals('pass', $mock->doSomething('foo', 'bar')); |
| 347 | 347 | } |
@@ -349,12 +349,12 @@ discard block |
||
| 349 | 349 | public function testPublicMethodCallback(): void |
| 350 | 350 | { |
| 351 | 351 | $mock = $this->getMockBuilder(SomeClass::class) |
| 352 | - ->setMethods(['doSomething']) |
|
| 353 | - ->getMock(); |
|
| 352 | + ->setMethods(['doSomething']) |
|
| 353 | + ->getMock(); |
|
| 354 | 354 | |
| 355 | 355 | $mock->expects($this->once()) |
| 356 | - ->method('doSomething') |
|
| 357 | - ->will($this->returnCallback([new MethodCallback, 'nonStaticCallback'])); |
|
| 356 | + ->method('doSomething') |
|
| 357 | + ->will($this->returnCallback([new MethodCallback, 'nonStaticCallback'])); |
|
| 358 | 358 | |
| 359 | 359 | $this->assertEquals('pass', $mock->doSomething('foo', 'bar')); |
| 360 | 360 | } |
@@ -362,10 +362,10 @@ discard block |
||
| 362 | 362 | public function testMockClassOnlyGeneratedOnce(): void |
| 363 | 363 | { |
| 364 | 364 | $mock1 = $this->getMockBuilder(AnInterface::class) |
| 365 | - ->getMock(); |
|
| 365 | + ->getMock(); |
|
| 366 | 366 | |
| 367 | 367 | $mock2 = $this->getMockBuilder(AnInterface::class) |
| 368 | - ->getMock(); |
|
| 368 | + ->getMock(); |
|
| 369 | 369 | |
| 370 | 370 | $this->assertEquals(\get_class($mock1), \get_class($mock2)); |
| 371 | 371 | } |
@@ -373,23 +373,23 @@ discard block |
||
| 373 | 373 | public function testMockClassDifferentForPartialMocks(): void |
| 374 | 374 | { |
| 375 | 375 | $mock1 = $this->getMockBuilder(PartialMockTestClass::class) |
| 376 | - ->getMock(); |
|
| 376 | + ->getMock(); |
|
| 377 | 377 | |
| 378 | 378 | $mock2 = $this->getMockBuilder(PartialMockTestClass::class) |
| 379 | - ->setMethods(['doSomething']) |
|
| 380 | - ->getMock(); |
|
| 379 | + ->setMethods(['doSomething']) |
|
| 380 | + ->getMock(); |
|
| 381 | 381 | |
| 382 | 382 | $mock3 = $this->getMockBuilder(PartialMockTestClass::class) |
| 383 | - ->setMethods(['doSomething']) |
|
| 384 | - ->getMock(); |
|
| 383 | + ->setMethods(['doSomething']) |
|
| 384 | + ->getMock(); |
|
| 385 | 385 | |
| 386 | 386 | $mock4 = $this->getMockBuilder(PartialMockTestClass::class) |
| 387 | - ->setMethods(['doAnotherThing']) |
|
| 388 | - ->getMock(); |
|
| 387 | + ->setMethods(['doAnotherThing']) |
|
| 388 | + ->getMock(); |
|
| 389 | 389 | |
| 390 | 390 | $mock5 = $this->getMockBuilder(PartialMockTestClass::class) |
| 391 | - ->setMethods(['doAnotherThing']) |
|
| 392 | - ->getMock(); |
|
| 391 | + ->setMethods(['doAnotherThing']) |
|
| 392 | + ->getMock(); |
|
| 393 | 393 | |
| 394 | 394 | $this->assertNotEquals(\get_class($mock1), \get_class($mock2)); |
| 395 | 395 | $this->assertNotEquals(\get_class($mock1), \get_class($mock3)); |
@@ -404,23 +404,23 @@ discard block |
||
| 404 | 404 | public function testMockClassStoreOverrulable(): void |
| 405 | 405 | { |
| 406 | 406 | $mock1 = $this->getMockBuilder(PartialMockTestClass::class) |
| 407 | - ->getMock(); |
|
| 407 | + ->getMock(); |
|
| 408 | 408 | |
| 409 | 409 | $mock2 = $this->getMockBuilder(PartialMockTestClass::class) |
| 410 | - ->setMockClassName('MyMockClassNameForPartialMockTestClass1') |
|
| 411 | - ->getMock(); |
|
| 410 | + ->setMockClassName('MyMockClassNameForPartialMockTestClass1') |
|
| 411 | + ->getMock(); |
|
| 412 | 412 | |
| 413 | 413 | $mock3 = $this->getMockBuilder(PartialMockTestClass::class) |
| 414 | - ->getMock(); |
|
| 414 | + ->getMock(); |
|
| 415 | 415 | |
| 416 | 416 | $mock4 = $this->getMockBuilder(PartialMockTestClass::class) |
| 417 | - ->setMethods(['doSomething']) |
|
| 418 | - ->setMockClassName('AnotherMockClassNameForPartialMockTestClass') |
|
| 419 | - ->getMock(); |
|
| 417 | + ->setMethods(['doSomething']) |
|
| 418 | + ->setMockClassName('AnotherMockClassNameForPartialMockTestClass') |
|
| 419 | + ->getMock(); |
|
| 420 | 420 | |
| 421 | 421 | $mock5 = $this->getMockBuilder(PartialMockTestClass::class) |
| 422 | - ->setMockClassName('MyMockClassNameForPartialMockTestClass2') |
|
| 423 | - ->getMock(); |
|
| 422 | + ->setMockClassName('MyMockClassNameForPartialMockTestClass2') |
|
| 423 | + ->getMock(); |
|
| 424 | 424 | |
| 425 | 425 | $this->assertNotEquals(\get_class($mock1), \get_class($mock2)); |
| 426 | 426 | $this->assertEquals(\get_class($mock1), \get_class($mock3)); |
@@ -442,11 +442,11 @@ discard block |
||
| 442 | 442 | public function testOriginalConstructorSettingConsidered(): void |
| 443 | 443 | { |
| 444 | 444 | $mock1 = $this->getMockBuilder(PartialMockTestClass::class) |
| 445 | - ->getMock(); |
|
| 445 | + ->getMock(); |
|
| 446 | 446 | |
| 447 | 447 | $mock2 = $this->getMockBuilder(PartialMockTestClass::class) |
| 448 | - ->disableOriginalConstructor() |
|
| 449 | - ->getMock(); |
|
| 448 | + ->disableOriginalConstructor() |
|
| 449 | + ->getMock(); |
|
| 450 | 450 | |
| 451 | 451 | $this->assertTrue($mock1->constructorCalled); |
| 452 | 452 | $this->assertFalse($mock2->constructorCalled); |
@@ -455,11 +455,11 @@ discard block |
||
| 455 | 455 | public function testOriginalCloneSettingConsidered(): void |
| 456 | 456 | { |
| 457 | 457 | $mock1 = $this->getMockBuilder(PartialMockTestClass::class) |
| 458 | - ->getMock(); |
|
| 458 | + ->getMock(); |
|
| 459 | 459 | |
| 460 | 460 | $mock2 = $this->getMockBuilder(PartialMockTestClass::class) |
| 461 | - ->disableOriginalClone() |
|
| 462 | - ->getMock(); |
|
| 461 | + ->disableOriginalClone() |
|
| 462 | + ->getMock(); |
|
| 463 | 463 | |
| 464 | 464 | $this->assertNotEquals(\get_class($mock1), \get_class($mock2)); |
| 465 | 465 | } |
@@ -467,10 +467,10 @@ discard block |
||
| 467 | 467 | public function testGetMockForAbstractClass(): void |
| 468 | 468 | { |
| 469 | 469 | $mock = $this->getMockBuilder(AbstractMockTestClass::class) |
| 470 | - ->getMock(); |
|
| 470 | + ->getMock(); |
|
| 471 | 471 | |
| 472 | 472 | $mock->expects($this->never()) |
| 473 | - ->method('doSomething'); |
|
| 473 | + ->method('doSomething'); |
|
| 474 | 474 | } |
| 475 | 475 | |
| 476 | 476 | /** |
@@ -479,7 +479,7 @@ discard block |
||
| 479 | 479 | public function testGetMockForTraversable($type): void |
| 480 | 480 | { |
| 481 | 481 | $mock = $this->getMockBuilder($type) |
| 482 | - ->getMock(); |
|
| 482 | + ->getMock(); |
|
| 483 | 483 | |
| 484 | 484 | $this->assertInstanceOf(Traversable::class, $mock); |
| 485 | 485 | } |
@@ -487,7 +487,7 @@ discard block |
||
| 487 | 487 | public function testMultipleInterfacesCanBeMockedInSingleObject(): void |
| 488 | 488 | { |
| 489 | 489 | $mock = $this->getMockBuilder([AnInterface::class, AnotherInterface::class]) |
| 490 | - ->getMock(); |
|
| 490 | + ->getMock(); |
|
| 491 | 491 | |
| 492 | 492 | $this->assertInstanceOf(AnInterface::class, $mock); |
| 493 | 493 | $this->assertInstanceOf(AnotherInterface::class, $mock); |
@@ -498,7 +498,7 @@ discard block |
||
| 498 | 498 | $mock = $this->getMockForTrait(AbstractTrait::class); |
| 499 | 499 | |
| 500 | 500 | $mock->expects($this->never()) |
| 501 | - ->method('doSomething'); |
|
| 501 | + ->method('doSomething'); |
|
| 502 | 502 | |
| 503 | 503 | $parent = \get_parent_class($mock); |
| 504 | 504 | $traits = \class_uses($parent, false); |
@@ -509,7 +509,7 @@ discard block |
||
| 509 | 509 | public function testClonedMockObjectShouldStillEqualTheOriginal(): void |
| 510 | 510 | { |
| 511 | 511 | $a = $this->getMockBuilder(stdClass::class) |
| 512 | - ->getMock(); |
|
| 512 | + ->getMock(); |
|
| 513 | 513 | |
| 514 | 514 | $b = clone $a; |
| 515 | 515 | |
@@ -519,10 +519,10 @@ discard block |
||
| 519 | 519 | public function testMockObjectsConstructedIndepentantlyShouldBeEqual(): void |
| 520 | 520 | { |
| 521 | 521 | $a = $this->getMockBuilder(stdClass::class) |
| 522 | - ->getMock(); |
|
| 522 | + ->getMock(); |
|
| 523 | 523 | |
| 524 | 524 | $b = $this->getMockBuilder(stdClass::class) |
| 525 | - ->getMock(); |
|
| 525 | + ->getMock(); |
|
| 526 | 526 | |
| 527 | 527 | $this->assertEquals($a, $b); |
| 528 | 528 | } |
@@ -530,10 +530,10 @@ discard block |
||
| 530 | 530 | public function testMockObjectsConstructedIndepentantlyShouldNotBeTheSame(): void |
| 531 | 531 | { |
| 532 | 532 | $a = $this->getMockBuilder(stdClass::class) |
| 533 | - ->getMock(); |
|
| 533 | + ->getMock(); |
|
| 534 | 534 | |
| 535 | 535 | $b = $this->getMockBuilder(stdClass::class) |
| 536 | - ->getMock(); |
|
| 536 | + ->getMock(); |
|
| 537 | 537 | |
| 538 | 538 | $this->assertNotSame($a, $b); |
| 539 | 539 | } |
@@ -541,17 +541,17 @@ discard block |
||
| 541 | 541 | public function testClonedMockObjectCanBeUsedInPlaceOfOriginalOne(): void |
| 542 | 542 | { |
| 543 | 543 | $x = $this->getMockBuilder(stdClass::class) |
| 544 | - ->getMock(); |
|
| 544 | + ->getMock(); |
|
| 545 | 545 | |
| 546 | 546 | $y = clone $x; |
| 547 | 547 | |
| 548 | 548 | $mock = $this->getMockBuilder(stdClass::class) |
| 549 | - ->setMethods(['foo']) |
|
| 550 | - ->getMock(); |
|
| 549 | + ->setMethods(['foo']) |
|
| 550 | + ->getMock(); |
|
| 551 | 551 | |
| 552 | 552 | $mock->expects($this->once()) |
| 553 | - ->method('foo') |
|
| 554 | - ->with($this->equalTo($x)); |
|
| 553 | + ->method('foo') |
|
| 554 | + ->with($this->equalTo($x)); |
|
| 555 | 555 | |
| 556 | 556 | $mock->foo($y); |
| 557 | 557 | } |
@@ -559,17 +559,17 @@ discard block |
||
| 559 | 559 | public function testClonedMockObjectIsNotIdenticalToOriginalOne(): void |
| 560 | 560 | { |
| 561 | 561 | $x = $this->getMockBuilder(stdClass::class) |
| 562 | - ->getMock(); |
|
| 562 | + ->getMock(); |
|
| 563 | 563 | |
| 564 | 564 | $y = clone $x; |
| 565 | 565 | |
| 566 | 566 | $mock = $this->getMockBuilder(stdClass::class) |
| 567 | - ->setMethods(['foo']) |
|
| 568 | - ->getMock(); |
|
| 567 | + ->setMethods(['foo']) |
|
| 568 | + ->getMock(); |
|
| 569 | 569 | |
| 570 | 570 | $mock->expects($this->once()) |
| 571 | - ->method('foo') |
|
| 572 | - ->with($this->logicalNot($this->identicalTo($x))); |
|
| 571 | + ->method('foo') |
|
| 572 | + ->with($this->logicalNot($this->identicalTo($x))); |
|
| 573 | 573 | |
| 574 | 574 | $mock->foo($y); |
| 575 | 575 | } |
@@ -579,21 +579,21 @@ discard block |
||
| 579 | 579 | $expectedObject = new stdClass; |
| 580 | 580 | |
| 581 | 581 | $mock = $this->getMockBuilder('SomeClass') |
| 582 | - ->setMethods(['doSomethingElse']) |
|
| 583 | - ->enableArgumentCloning() |
|
| 584 | - ->getMock(); |
|
| 582 | + ->setMethods(['doSomethingElse']) |
|
| 583 | + ->enableArgumentCloning() |
|
| 584 | + ->getMock(); |
|
| 585 | 585 | |
| 586 | 586 | $actualArguments = []; |
| 587 | 587 | |
| 588 | 588 | $mock->expects($this->any()) |
| 589 | - ->method('doSomethingElse') |
|
| 590 | - ->will( |
|
| 591 | - $this->returnCallback( |
|
| 592 | - function () use (&$actualArguments): void { |
|
| 593 | - $actualArguments = \func_get_args(); |
|
| 594 | - } |
|
| 595 | - ) |
|
| 596 | - ); |
|
| 589 | + ->method('doSomethingElse') |
|
| 590 | + ->will( |
|
| 591 | + $this->returnCallback( |
|
| 592 | + function () use (&$actualArguments): void { |
|
| 593 | + $actualArguments = \func_get_args(); |
|
| 594 | + } |
|
| 595 | + ) |
|
| 596 | + ); |
|
| 597 | 597 | |
| 598 | 598 | $mock->doSomethingElse($expectedObject); |
| 599 | 599 | |
@@ -607,21 +607,21 @@ discard block |
||
| 607 | 607 | $expectedObject = new stdClass; |
| 608 | 608 | |
| 609 | 609 | $mock = $this->getMockBuilder('SomeClass') |
| 610 | - ->setMethods(['doSomethingElse']) |
|
| 611 | - ->disableArgumentCloning() |
|
| 612 | - ->getMock(); |
|
| 610 | + ->setMethods(['doSomethingElse']) |
|
| 611 | + ->disableArgumentCloning() |
|
| 612 | + ->getMock(); |
|
| 613 | 613 | |
| 614 | 614 | $actualArguments = []; |
| 615 | 615 | |
| 616 | 616 | $mock->expects($this->any()) |
| 617 | - ->method('doSomethingElse') |
|
| 618 | - ->will( |
|
| 619 | - $this->returnCallback( |
|
| 620 | - function () use (&$actualArguments): void { |
|
| 621 | - $actualArguments = \func_get_args(); |
|
| 622 | - } |
|
| 623 | - ) |
|
| 624 | - ); |
|
| 617 | + ->method('doSomethingElse') |
|
| 618 | + ->will( |
|
| 619 | + $this->returnCallback( |
|
| 620 | + function () use (&$actualArguments): void { |
|
| 621 | + $actualArguments = \func_get_args(); |
|
| 622 | + } |
|
| 623 | + ) |
|
| 624 | + ); |
|
| 625 | 625 | |
| 626 | 626 | $mock->doSomethingElse($expectedObject); |
| 627 | 627 | |
@@ -637,9 +637,9 @@ discard block |
||
| 637 | 637 | ->getMock(); |
| 638 | 638 | |
| 639 | 639 | $mockWithoutCloning = $this->getMockBuilder('SomeClass') |
| 640 | - ->setMethods(['doSomethingElse']) |
|
| 641 | - ->disableArgumentCloning() |
|
| 642 | - ->getMock(); |
|
| 640 | + ->setMethods(['doSomethingElse']) |
|
| 641 | + ->disableArgumentCloning() |
|
| 642 | + ->getMock(); |
|
| 643 | 643 | |
| 644 | 644 | $this->assertNotEquals($mockWithCloning, $mockWithoutCloning); |
| 645 | 645 | } |
@@ -647,11 +647,11 @@ discard block |
||
| 647 | 647 | public function testVerificationOfMethodNameFailsWithoutParameters(): void |
| 648 | 648 | { |
| 649 | 649 | $mock = $this->getMockBuilder(SomeClass::class) |
| 650 | - ->setMethods(['right', 'wrong']) |
|
| 651 | - ->getMock(); |
|
| 650 | + ->setMethods(['right', 'wrong']) |
|
| 651 | + ->getMock(); |
|
| 652 | 652 | |
| 653 | 653 | $mock->expects($this->once()) |
| 654 | - ->method('right'); |
|
| 654 | + ->method('right'); |
|
| 655 | 655 | |
| 656 | 656 | $mock->wrong(); |
| 657 | 657 | |
@@ -672,11 +672,11 @@ discard block |
||
| 672 | 672 | public function testVerificationOfMethodNameFailsWithParameters(): void |
| 673 | 673 | { |
| 674 | 674 | $mock = $this->getMockBuilder(SomeClass::class) |
| 675 | - ->setMethods(['right', 'wrong']) |
|
| 676 | - ->getMock(); |
|
| 675 | + ->setMethods(['right', 'wrong']) |
|
| 676 | + ->getMock(); |
|
| 677 | 677 | |
| 678 | 678 | $mock->expects($this->once()) |
| 679 | - ->method('right'); |
|
| 679 | + ->method('right'); |
|
| 680 | 680 | |
| 681 | 681 | $mock->wrong(); |
| 682 | 682 | |
@@ -697,12 +697,12 @@ discard block |
||
| 697 | 697 | public function testVerificationOfMethodNameFailsWithWrongParameters(): void |
| 698 | 698 | { |
| 699 | 699 | $mock = $this->getMockBuilder(SomeClass::class) |
| 700 | - ->setMethods(['right', 'wrong']) |
|
| 701 | - ->getMock(); |
|
| 700 | + ->setMethods(['right', 'wrong']) |
|
| 701 | + ->getMock(); |
|
| 702 | 702 | |
| 703 | 703 | $mock->expects($this->once()) |
| 704 | - ->method('right') |
|
| 705 | - ->with(['first', 'second']); |
|
| 704 | + ->method('right') |
|
| 705 | + ->with(['first', 'second']); |
|
| 706 | 706 | |
| 707 | 707 | try { |
| 708 | 708 | $mock->right(['second']); |
@@ -743,12 +743,12 @@ discard block |
||
| 743 | 743 | public function testVerificationOfNeverFailsWithEmptyParameters(): void |
| 744 | 744 | { |
| 745 | 745 | $mock = $this->getMockBuilder(SomeClass::class) |
| 746 | - ->setMethods(['right', 'wrong']) |
|
| 747 | - ->getMock(); |
|
| 746 | + ->setMethods(['right', 'wrong']) |
|
| 747 | + ->getMock(); |
|
| 748 | 748 | |
| 749 | 749 | $mock->expects($this->never()) |
| 750 | - ->method('right') |
|
| 751 | - ->with(); |
|
| 750 | + ->method('right') |
|
| 751 | + ->with(); |
|
| 752 | 752 | |
| 753 | 753 | try { |
| 754 | 754 | $mock->right(); |
@@ -766,12 +766,12 @@ discard block |
||
| 766 | 766 | public function testVerificationOfNeverFailsWithAnyParameters(): void |
| 767 | 767 | { |
| 768 | 768 | $mock = $this->getMockBuilder(SomeClass::class) |
| 769 | - ->setMethods(['right', 'wrong']) |
|
| 770 | - ->getMock(); |
|
| 769 | + ->setMethods(['right', 'wrong']) |
|
| 770 | + ->getMock(); |
|
| 771 | 771 | |
| 772 | 772 | $mock->expects($this->never()) |
| 773 | - ->method('right') |
|
| 774 | - ->withAnyParameters(); |
|
| 773 | + ->method('right') |
|
| 774 | + ->withAnyParameters(); |
|
| 775 | 775 | |
| 776 | 776 | try { |
| 777 | 777 | $mock->right(); |
@@ -789,12 +789,12 @@ discard block |
||
| 789 | 789 | public function testWithAnythingInsteadOfWithAnyParameters(): void |
| 790 | 790 | { |
| 791 | 791 | $mock = $this->getMockBuilder(SomeClass::class) |
| 792 | - ->setMethods(['right', 'wrong']) |
|
| 793 | - ->getMock(); |
|
| 792 | + ->setMethods(['right', 'wrong']) |
|
| 793 | + ->getMock(); |
|
| 794 | 794 | |
| 795 | 795 | $mock->expects($this->once()) |
| 796 | - ->method('right') |
|
| 797 | - ->with($this->anything()); |
|
| 796 | + ->method('right') |
|
| 797 | + ->with($this->anything()); |
|
| 798 | 798 | |
| 799 | 799 | try { |
| 800 | 800 | $mock->right(); |
@@ -982,8 +982,8 @@ discard block |
||
| 982 | 982 | $this->assertInstanceOf( |
| 983 | 983 | ClassThatImplementsSerializable::class, |
| 984 | 984 | $this->getMockBuilder(ClassThatImplementsSerializable::class) |
| 985 | - ->disableOriginalConstructor() |
|
| 986 | - ->getMock() |
|
| 985 | + ->disableOriginalConstructor() |
|
| 986 | + ->getMock() |
|
| 987 | 987 | ); |
| 988 | 988 | } |
| 989 | 989 | |
@@ -589,7 +589,7 @@ discard block |
||
| 589 | 589 | ->method('doSomethingElse') |
| 590 | 590 | ->will( |
| 591 | 591 | $this->returnCallback( |
| 592 | - function () use (&$actualArguments): void { |
|
| 592 | + function() use (&$actualArguments): void { |
|
| 593 | 593 | $actualArguments = \func_get_args(); |
| 594 | 594 | } |
| 595 | 595 | ) |
@@ -617,7 +617,7 @@ discard block |
||
| 617 | 617 | ->method('doSomethingElse') |
| 618 | 618 | ->will( |
| 619 | 619 | $this->returnCallback( |
| 620 | - function () use (&$actualArguments): void { |
|
| 620 | + function() use (&$actualArguments): void { |
|
| 621 | 621 | $actualArguments = \func_get_args(); |
| 622 | 622 | } |
| 623 | 623 | ) |
@@ -846,7 +846,7 @@ discard block |
||
| 846 | 846 | $foo->expects($this->any()) |
| 847 | 847 | ->method('bar') |
| 848 | 848 | ->will($this->returnCallback( |
| 849 | - function (&$a, &$b, $c): void { |
|
| 849 | + function(&$a, &$b, $c): void { |
|
| 850 | 850 | $b = 1; |
| 851 | 851 | } |
| 852 | 852 | )); |
@@ -1000,7 +1000,7 @@ discard block |
||
| 1000 | 1000 | /** @var PHPUnit\Framework\MockObject\MockObject|StringableClass $mock */ |
| 1001 | 1001 | $mock = $this->getMockBuilder(StringableClass::class)->getMock(); |
| 1002 | 1002 | |
| 1003 | - $this->assertIsString((string) $mock); |
|
| 1003 | + $this->assertIsString((string)$mock); |
|
| 1004 | 1004 | } |
| 1005 | 1005 | |
| 1006 | 1006 | public function testStringableClassCanBeMocked(): void |
@@ -1010,7 +1010,7 @@ discard block |
||
| 1010 | 1010 | |
| 1011 | 1011 | $mock->method('__toString')->willReturn('foo'); |
| 1012 | 1012 | |
| 1013 | - $this->assertSame('foo', (string) $mock); |
|
| 1013 | + $this->assertSame('foo', (string)$mock); |
|
| 1014 | 1014 | } |
| 1015 | 1015 | |
| 1016 | 1016 | public function traversableProvider(): array |
@@ -1032,7 +1032,7 @@ discard block |
||
| 1032 | 1032 | $callCount = 0; |
| 1033 | 1033 | |
| 1034 | 1034 | $mock->expects($this->exactly($expectedNumberOfCalls))->method('bar') |
| 1035 | - ->with($this->callback(function ($argument) use (&$callCount) { |
|
| 1035 | + ->with($this->callback(function($argument) use (&$callCount) { |
|
| 1036 | 1036 | return $argument === 'call_' . $callCount++; |
| 1037 | 1037 | })); |
| 1038 | 1038 | |
@@ -1076,7 +1076,7 @@ discard block |
||
| 1076 | 1076 | ->disableAutoReturnValueGeneration() |
| 1077 | 1077 | ->getMock(); |
| 1078 | 1078 | |
| 1079 | - (string) $mock; |
|
| 1079 | + (string)$mock; |
|
| 1080 | 1080 | |
| 1081 | 1081 | try { |
| 1082 | 1082 | $mock->__phpunit_verify(); |
@@ -102,8 +102,8 @@ |
||
| 102 | 102 | $mock = $this->generator->getMockForAbstractClass(AbstractMockTestClass::class); |
| 103 | 103 | |
| 104 | 104 | $mock->expects($this->any()) |
| 105 | - ->method('doSomething') |
|
| 106 | - ->willReturn('testing'); |
|
| 105 | + ->method('doSomething') |
|
| 106 | + ->willReturn('testing'); |
|
| 107 | 107 | |
| 108 | 108 | $this->assertEquals('testing', $mock->doSomething()); |
| 109 | 109 | $this->assertEquals(1, $mock->returnAnything()); |
@@ -31,8 +31,8 @@ discard block |
||
| 31 | 31 | public function testMethodsToMockCanBeSpecified(): void |
| 32 | 32 | { |
| 33 | 33 | $mock = $this->getMockBuilder(Mockable::class) |
| 34 | - ->setMethods(['mockableMethod']) |
|
| 35 | - ->getMock(); |
|
| 34 | + ->setMethods(['mockableMethod']) |
|
| 35 | + ->getMock(); |
|
| 36 | 36 | |
| 37 | 37 | $this->assertNull($mock->mockableMethod()); |
| 38 | 38 | $this->assertTrue($mock->anotherMockableMethod()); |
@@ -68,8 +68,8 @@ discard block |
||
| 68 | 68 | public function testMockClassNameCanBeSpecified(): void |
| 69 | 69 | { |
| 70 | 70 | $mock = $this->getMockBuilder(Mockable::class) |
| 71 | - ->setMockClassName('ACustomClassName') |
|
| 72 | - ->getMock(); |
|
| 71 | + ->setMockClassName('ACustomClassName') |
|
| 72 | + ->getMock(); |
|
| 73 | 73 | |
| 74 | 74 | $this->assertInstanceOf(ACustomClassName::class, $mock); |
| 75 | 75 | } |
@@ -77,8 +77,8 @@ discard block |
||
| 77 | 77 | public function testConstructorArgumentsCanBeSpecified(): void |
| 78 | 78 | { |
| 79 | 79 | $mock = $this->getMockBuilder(Mockable::class) |
| 80 | - ->setConstructorArgs([23, 42]) |
|
| 81 | - ->getMock(); |
|
| 80 | + ->setConstructorArgs([23, 42]) |
|
| 81 | + ->getMock(); |
|
| 82 | 82 | |
| 83 | 83 | $this->assertEquals([23, 42], $mock->constructorArgs); |
| 84 | 84 | } |
@@ -86,8 +86,8 @@ discard block |
||
| 86 | 86 | public function testOriginalConstructorCanBeDisabled(): void |
| 87 | 87 | { |
| 88 | 88 | $mock = $this->getMockBuilder(Mockable::class) |
| 89 | - ->disableOriginalConstructor() |
|
| 90 | - ->getMock(); |
|
| 89 | + ->disableOriginalConstructor() |
|
| 90 | + ->getMock(); |
|
| 91 | 91 | |
| 92 | 92 | $this->assertNull($mock->constructorArgs); |
| 93 | 93 | } |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | public function testByDefaultOriginalCloneIsPreserved(): void |
| 96 | 96 | { |
| 97 | 97 | $mock = $this->getMockBuilder(Mockable::class) |
| 98 | - ->getMock(); |
|
| 98 | + ->getMock(); |
|
| 99 | 99 | |
| 100 | 100 | $cloned = clone $mock; |
| 101 | 101 | |
@@ -105,8 +105,8 @@ discard block |
||
| 105 | 105 | public function testOriginalCloneCanBeDisabled(): void |
| 106 | 106 | { |
| 107 | 107 | $mock = $this->getMockBuilder(Mockable::class) |
| 108 | - ->disableOriginalClone() |
|
| 109 | - ->getMock(); |
|
| 108 | + ->disableOriginalClone() |
|
| 109 | + ->getMock(); |
|
| 110 | 110 | |
| 111 | 111 | $mock->cloned = false; |
| 112 | 112 | $cloned = clone $mock; |
@@ -117,12 +117,12 @@ discard block |
||
| 117 | 117 | public function testProvidesAFluentInterface(): void |
| 118 | 118 | { |
| 119 | 119 | $spec = $this->getMockBuilder(Mockable::class) |
| 120 | - ->setMethods(['mockableMethod']) |
|
| 121 | - ->setConstructorArgs([]) |
|
| 122 | - ->setMockClassName('DummyClassName') |
|
| 123 | - ->disableOriginalConstructor() |
|
| 124 | - ->disableOriginalClone() |
|
| 125 | - ->disableAutoload(); |
|
| 120 | + ->setMethods(['mockableMethod']) |
|
| 121 | + ->setConstructorArgs([]) |
|
| 122 | + ->setMockClassName('DummyClassName') |
|
| 123 | + ->disableOriginalConstructor() |
|
| 124 | + ->disableOriginalClone() |
|
| 125 | + ->disableAutoload(); |
|
| 126 | 126 | |
| 127 | 127 | $this->assertInstanceOf(MockBuilder::class, $spec); |
| 128 | 128 | } |
@@ -17,15 +17,15 @@ discard block |
||
| 17 | 17 | public function testIntegration(): void |
| 18 | 18 | { |
| 19 | 19 | $mock = $this->getMockBuilder(stdClass::class) |
| 20 | - ->setMethods(['foo']) |
|
| 21 | - ->getMock(); |
|
| 20 | + ->setMethods(['foo']) |
|
| 21 | + ->getMock(); |
|
| 22 | 22 | |
| 23 | 23 | $mock->expects($this->any()) |
| 24 | - ->method('foo') |
|
| 25 | - ->withConsecutive( |
|
| 26 | - ['bar'], |
|
| 27 | - [21, 42] |
|
| 28 | - ); |
|
| 24 | + ->method('foo') |
|
| 25 | + ->withConsecutive( |
|
| 26 | + ['bar'], |
|
| 27 | + [21, 42] |
|
| 28 | + ); |
|
| 29 | 29 | |
| 30 | 30 | $this->assertNull($mock->foo('bar')); |
| 31 | 31 | $this->assertNull($mock->foo(21, 42)); |
@@ -34,14 +34,14 @@ discard block |
||
| 34 | 34 | public function testIntegrationWithLessAssertionsThanMethodCalls(): void |
| 35 | 35 | { |
| 36 | 36 | $mock = $this->getMockBuilder(stdClass::class) |
| 37 | - ->setMethods(['foo']) |
|
| 38 | - ->getMock(); |
|
| 37 | + ->setMethods(['foo']) |
|
| 38 | + ->getMock(); |
|
| 39 | 39 | |
| 40 | 40 | $mock->expects($this->any()) |
| 41 | - ->method('foo') |
|
| 42 | - ->withConsecutive( |
|
| 43 | - ['bar'] |
|
| 44 | - ); |
|
| 41 | + ->method('foo') |
|
| 42 | + ->withConsecutive( |
|
| 43 | + ['bar'] |
|
| 44 | + ); |
|
| 45 | 45 | |
| 46 | 46 | $this->assertNull($mock->foo('bar')); |
| 47 | 47 | $this->assertNull($mock->foo(21, 42)); |
@@ -50,15 +50,15 @@ discard block |
||
| 50 | 50 | public function testIntegrationExpectingException(): void |
| 51 | 51 | { |
| 52 | 52 | $mock = $this->getMockBuilder(stdClass::class) |
| 53 | - ->setMethods(['foo']) |
|
| 54 | - ->getMock(); |
|
| 53 | + ->setMethods(['foo']) |
|
| 54 | + ->getMock(); |
|
| 55 | 55 | |
| 56 | 56 | $mock->expects($this->any()) |
| 57 | - ->method('foo') |
|
| 58 | - ->withConsecutive( |
|
| 59 | - ['bar'], |
|
| 60 | - [21, 42] |
|
| 61 | - ); |
|
| 57 | + ->method('foo') |
|
| 58 | + ->withConsecutive( |
|
| 59 | + ['bar'], |
|
| 60 | + [21, 42] |
|
| 61 | + ); |
|
| 62 | 62 | |
| 63 | 63 | $mock->foo('bar'); |
| 64 | 64 | |
@@ -16,12 +16,12 @@ discard block |
||
| 16 | 16 | public function testWillReturnWithOneValue(): void |
| 17 | 17 | { |
| 18 | 18 | $mock = $this->getMockBuilder(stdClass::class) |
| 19 | - ->setMethods(['foo']) |
|
| 20 | - ->getMock(); |
|
| 19 | + ->setMethods(['foo']) |
|
| 20 | + ->getMock(); |
|
| 21 | 21 | |
| 22 | 22 | $mock->expects($this->any()) |
| 23 | - ->method('foo') |
|
| 24 | - ->willReturn(1); |
|
| 23 | + ->method('foo') |
|
| 24 | + ->willReturn(1); |
|
| 25 | 25 | |
| 26 | 26 | $this->assertEquals(1, $mock->foo()); |
| 27 | 27 | } |
@@ -29,12 +29,12 @@ discard block |
||
| 29 | 29 | public function testWillReturnWithMultipleValues(): void |
| 30 | 30 | { |
| 31 | 31 | $mock = $this->getMockBuilder(stdClass::class) |
| 32 | - ->setMethods(['foo']) |
|
| 33 | - ->getMock(); |
|
| 32 | + ->setMethods(['foo']) |
|
| 33 | + ->getMock(); |
|
| 34 | 34 | |
| 35 | 35 | $mock->expects($this->any()) |
| 36 | - ->method('foo') |
|
| 37 | - ->willReturn(1, 2, 3); |
|
| 36 | + ->method('foo') |
|
| 37 | + ->willReturn(1, 2, 3); |
|
| 38 | 38 | |
| 39 | 39 | $this->assertEquals(1, $mock->foo()); |
| 40 | 40 | $this->assertEquals(2, $mock->foo()); |
@@ -44,12 +44,12 @@ discard block |
||
| 44 | 44 | public function testWillReturnOnConsecutiveCalls(): void |
| 45 | 45 | { |
| 46 | 46 | $mock = $this->getMockBuilder(stdClass::class) |
| 47 | - ->setMethods(['foo']) |
|
| 48 | - ->getMock(); |
|
| 47 | + ->setMethods(['foo']) |
|
| 48 | + ->getMock(); |
|
| 49 | 49 | |
| 50 | 50 | $mock->expects($this->any()) |
| 51 | - ->method('foo') |
|
| 52 | - ->willReturnOnConsecutiveCalls(1, 2, 3); |
|
| 51 | + ->method('foo') |
|
| 52 | + ->willReturnOnConsecutiveCalls(1, 2, 3); |
|
| 53 | 53 | |
| 54 | 54 | $this->assertEquals(1, $mock->foo()); |
| 55 | 55 | $this->assertEquals(2, $mock->foo()); |
@@ -59,12 +59,12 @@ discard block |
||
| 59 | 59 | public function testWillReturnByReference(): void |
| 60 | 60 | { |
| 61 | 61 | $mock = $this->getMockBuilder(stdClass::class) |
| 62 | - ->setMethods(['foo']) |
|
| 63 | - ->getMock(); |
|
| 62 | + ->setMethods(['foo']) |
|
| 63 | + ->getMock(); |
|
| 64 | 64 | |
| 65 | 65 | $mock->expects($this->any()) |
| 66 | - ->method('foo') |
|
| 67 | - ->willReturnReference($value); |
|
| 66 | + ->method('foo') |
|
| 67 | + ->willReturnReference($value); |
|
| 68 | 68 | |
| 69 | 69 | $this->assertNull($mock->foo()); |
| 70 | 70 | $value = 'foo'; |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | $proxy = $this->createTestProxy(TestProxyFixture::class); |
| 19 | 19 | |
| 20 | 20 | $proxy->expects($this->once()) |
| 21 | - ->method('returnString'); |
|
| 21 | + ->method('returnString'); |
|
| 22 | 22 | |
| 23 | 23 | \assert($proxy instanceof MockObject); |
| 24 | 24 | \assert($proxy instanceof TestProxyFixture); |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | $proxy = $this->createTestProxy(TestProxyFixture::class); |
| 32 | 32 | |
| 33 | 33 | $proxy->expects($this->once()) |
| 34 | - ->method('returnTypedString'); |
|
| 34 | + ->method('returnTypedString'); |
|
| 35 | 35 | |
| 36 | 36 | \assert($proxy instanceof MockObject); |
| 37 | 37 | \assert($proxy instanceof TestProxyFixture); |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | $proxy = $this->createTestProxy(TestProxyFixture::class); |
| 45 | 45 | |
| 46 | 46 | $proxy->expects($this->once()) |
| 47 | - ->method('returnObject'); |
|
| 47 | + ->method('returnObject'); |
|
| 48 | 48 | |
| 49 | 49 | \assert($proxy instanceof MockObject); |
| 50 | 50 | \assert($proxy instanceof TestProxyFixture); |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | $proxy = $this->createTestProxy(TestProxyFixture::class); |
| 58 | 58 | |
| 59 | 59 | $proxy->expects($this->once()) |
| 60 | - ->method('returnTypedObject'); |
|
| 60 | + ->method('returnTypedObject'); |
|
| 61 | 61 | |
| 62 | 62 | \assert($proxy instanceof MockObject); |
| 63 | 63 | \assert($proxy instanceof TestProxyFixture); |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $proxy = $this->createTestProxy(TestProxyFixture::class); |
| 71 | 71 | |
| 72 | 72 | $proxy->expects($this->once()) |
| 73 | - ->method('returnObjectOfFinalClass'); |
|
| 73 | + ->method('returnObjectOfFinalClass'); |
|
| 74 | 74 | |
| 75 | 75 | \assert($proxy instanceof MockObject); |
| 76 | 76 | \assert($proxy instanceof TestProxyFixture); |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | $proxy = $this->createTestProxy(TestProxyFixture::class); |
| 84 | 84 | |
| 85 | 85 | $proxy->expects($this->once()) |
| 86 | - ->method('returnTypedObjectOfFinalClass'); |
|
| 86 | + ->method('returnTypedObjectOfFinalClass'); |
|
| 87 | 87 | |
| 88 | 88 | \assert($proxy instanceof MockObject); |
| 89 | 89 | \assert($proxy instanceof TestProxyFixture); |