Skip to content

Commit 03a199d

Browse files
committed
Tweak tests
1 parent a287aef commit 03a199d

File tree

3 files changed

+11
-15
lines changed

3 files changed

+11
-15
lines changed

tests/Annotation/Processor/RequiresProcessorTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ final class RequiresProcessorTest extends TestCase
2323
public function testProcessProcessesRequirement() : void
2424
{
2525
$requirement = $this->createMock(Requirement::class);
26-
$requirement->expects($this->once())->method('getName')->willReturn('Foobar');
27-
$requirement->expects($this->once())->method('check')->with('42')->willReturn(null);
26+
$requirement->expects(self::once())->method('getName')->willReturn('Foobar');
27+
$requirement->expects(self::once())->method('check')->with('42')->willReturn(null);
2828

2929
$processor = new RequiresProcessor([$requirement]);
3030
$processor->process('Foobar 42');
@@ -33,8 +33,8 @@ public function testProcessProcessesRequirement() : void
3333
public function testProcessProcessesRequirementWithoutValue() : void
3434
{
3535
$requirement = $this->createMock(Requirement::class);
36-
$requirement->expects($this->once())->method('getName')->willReturn('Foobar');
37-
$requirement->expects($this->once())->method('check')->with('')->willReturn(null);
36+
$requirement->expects(self::once())->method('getName')->willReturn('Foobar');
37+
$requirement->expects(self::once())->method('check')->with('')->willReturn(null);
3838

3939
$processor = new RequiresProcessor([$requirement]);
4040
$processor->process('Foobar');

tests/Expectation/ExpressionExpectationTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,17 @@ protected function setUp() : void
3434

3535
public function testVerifySucceeds() : void
3636
{
37-
$this->context->expects($this->atLeastOnce())->method('getExpression')->willReturn('a + b === 3');
38-
$this->context->expects($this->atLeastOnce())->method('getValues')->willReturn(['a' => 1, 'b' => 2]);
37+
$this->context->expects(self::atLeastOnce())->method('getExpression')->willReturn('a + b === 3');
38+
$this->context->expects(self::atLeastOnce())->method('getValues')->willReturn(['a' => 1, 'b' => 2]);
3939

4040
$expectation = new ExpressionExpectation($this->context);
4141
$expectation->verify();
4242
}
4343

4444
public function testVerifyFails() : void
4545
{
46-
$this->context->expects($this->atLeastOnce())->method('getExpression')->willReturn('a + b === 3');
47-
$this->context->expects($this->atLeastOnce())->method('getValues')->willReturn(['a' => 1, 'b' => 7]);
46+
$this->context->expects(self::atLeastOnce())->method('getExpression')->willReturn('a + b === 3');
47+
$this->context->expects(self::atLeastOnce())->method('getValues')->willReturn(['a' => 1, 'b' => 7]);
4848

4949
$expectation = new ExpressionExpectation($this->context);
5050

tests/PHPUnitCompat.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,8 @@ trait PHPUnitCompat
2020
{
2121
public function expectExceptionMessageMatches(string $regularExpression) : void
2222
{
23-
if (\is_callable('parent::expectExceptionMessageMatches')) {
24-
parent::expectExceptionMessageMatches($regularExpression);
25-
26-
return;
27-
}
28-
29-
parent::expectExceptionMessageRegExp($regularExpression);
23+
\is_callable('parent::expectExceptionMessageMatches')
24+
? parent::expectExceptionMessageMatches($regularExpression)
25+
: parent::expectExceptionMessageRegExp($regularExpression);
3026
}
3127
}

0 commit comments

Comments
 (0)