Skip to content

Commit

Permalink
fixup! fixup! dep: update PHPUnit from 7 to 8 [CRE-1222]
Browse files Browse the repository at this point in the history
  • Loading branch information
MorrisJobke committed Sep 7, 2022
1 parent 0994109 commit 9661195
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 26 deletions.
5 changes: 1 addition & 4 deletions src/PartialStubBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@ public function withArgument($index, $argument)
return $this;
}

/**
* @return MockObject
*/
protected function createStub()
protected function createStub(): MockObject
{
$a = $this->testCase
->getMockBuilder($this->className)
Expand Down
3 changes: 1 addition & 2 deletions src/SimpleEqualsConstraint.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ class SimpleEqualsConstraint extends Constraint
public function __construct($expected)
{
$this->expected = $expected;
parent::__construct();
}

protected function matches($other): bool
Expand All @@ -29,7 +28,7 @@ public function toString(): string
{
return sprintf(
'equals (==) %s',
$this->exporter->export($this->expected)
$this->exporter()->export($this->expected)
);
}
}
24 changes: 4 additions & 20 deletions src/StubBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace TestDataBuilder;

use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\MockObject\Stub;
use PHPUnit\Framework\MockObject\Stub\Stub;
use PHPUnit\Framework\TestCase;

class StubBuilder extends CustomBuilder
Expand All @@ -28,16 +28,6 @@ public function __construct($className, TestCase $testCase)
$this->testCase = $testCase;
}

/**
* @param string $method
* @param mixed $will
* @return StubBuilder
*/
public function with($method, $will)
{
return parent::with($method, $will);
}

/**
* @return MockObject
*/
Expand All @@ -48,18 +38,12 @@ public function build()
return $stub;
}

/**
* @return MockObject
*/
protected function createStub()
protected function createStub(): MockObject
{
return $this->testCase->getMockBuilder($this->className)->disableOriginalConstructor()->getMock();
}

/**
* @param MockObject $stub
*/
protected function loadMethodStubs($stub)
protected function loadMethodStubs(MockObject $stub)
{
foreach ($this->fields as $field => $will) {
$will = $this->buildStub($will);
Expand All @@ -70,7 +54,7 @@ protected function loadMethodStubs($stub)
}
}

protected function buildStub($will)
protected function buildStub($will): Stub
{
if (!is_object($will) || !($will instanceof Stub)) {
$will = $this->testCase->returnValue($this->buildIfValueIsABuilder($will));
Expand Down

0 comments on commit 9661195

Please sign in to comment.