Skip to content

Commit

Permalink
Tweak tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rybakit committed Dec 11, 2020
1 parent a287aef commit 03a199d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 deletions.
8 changes: 4 additions & 4 deletions tests/Annotation/Processor/RequiresProcessorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ final class RequiresProcessorTest extends TestCase
public function testProcessProcessesRequirement() : void
{
$requirement = $this->createMock(Requirement::class);
$requirement->expects($this->once())->method('getName')->willReturn('Foobar');
$requirement->expects($this->once())->method('check')->with('42')->willReturn(null);
$requirement->expects(self::once())->method('getName')->willReturn('Foobar');
$requirement->expects(self::once())->method('check')->with('42')->willReturn(null);

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

$processor = new RequiresProcessor([$requirement]);
$processor->process('Foobar');
Expand Down
8 changes: 4 additions & 4 deletions tests/Expectation/ExpressionExpectationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@ protected function setUp() : void

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

$expectation = new ExpressionExpectation($this->context);
$expectation->verify();
}

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

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

Expand Down
10 changes: 3 additions & 7 deletions tests/PHPUnitCompat.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,8 @@ trait PHPUnitCompat
{
public function expectExceptionMessageMatches(string $regularExpression) : void
{
if (\is_callable('parent::expectExceptionMessageMatches')) {
parent::expectExceptionMessageMatches($regularExpression);

return;
}

parent::expectExceptionMessageRegExp($regularExpression);
\is_callable('parent::expectExceptionMessageMatches')
? parent::expectExceptionMessageMatches($regularExpression)
: parent::expectExceptionMessageRegExp($regularExpression);
}
}

0 comments on commit 03a199d

Please sign in to comment.