Skip to content

Commit

Permalink
Merge branch '11.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Dec 11, 2024
2 parents 6d5dbaf + b3dddef commit 3c1f893
Show file tree
Hide file tree
Showing 4 changed files with 123 additions and 123 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ final class CreateConfiguredMockTest extends TestCase
{
public function testCreatesMockObjectForInterfaceOrExtendableClassWithReturnValueConfigurationForMultipleMethods(): void
{
$stub = $this->createConfiguredMock(
$double = $this->createConfiguredMock(
InterfaceWithReturnTypeDeclaration::class,
[
'doSomething' => true,
'doSomethingElse' => 1,
],
);

$this->assertTrue($stub->doSomething());
$this->assertSame(1, $stub->doSomethingElse(0));
$this->assertTrue($double->doSomething());
$this->assertSame(1, $double->doSomethingElse(0));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ final class CreateConfiguredStubTest extends TestCase
{
public function testCreatesTestStubForInterfaceOrExtendableClassWithReturnValueConfigurationForMultipleMethods(): void
{
$stub = $this->createConfiguredStub(
$double = $this->createConfiguredStub(
InterfaceWithReturnTypeDeclaration::class,
[
'doSomething' => true,
'doSomethingElse' => 1,
],
);

$this->assertTrue($stub->doSomething());
$this->assertSame(1, $stub->doSomethingElse(0));
$this->assertTrue($double->doSomething());
$this->assertSame(1, $double->doSomethingElse(0));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ final class CreatePartialMockTest extends TestCase
{
public function testCreatesPartialMockObjectForExtendableClass(): void
{
$mock = $this->createPartialMock(ExtendableClass::class, ['doSomethingElse']);
$double = $this->createPartialMock(ExtendableClass::class, ['doSomethingElse']);

$mock->expects($this->once())->method('doSomethingElse')->willReturn(true);
$double->expects($this->once())->method('doSomethingElse')->willReturn(true);

$this->assertTrue($mock->doSomething());
$this->assertTrue($double->doSomething());
}

public function testCannotCreatePartialMockObjectForExtendableClassWithDuplicateMethods(): void
Expand All @@ -43,10 +43,10 @@ public function testCannotCreatePartialMockObjectForExtendableClassWithDuplicate

public function testMethodOfPartialMockThatIsNotConfigurableCannotBeConfigured(): void
{
$mock = $this->createPartialMock(ExtendableClass::class, ['doSomethingElse']);
$double = $this->createPartialMock(ExtendableClass::class, ['doSomethingElse']);

try {
$mock->expects($this->once())->method('doSomething')->willReturn(true);
$double->expects($this->once())->method('doSomething')->willReturn(true);
} catch (MethodCannotBeConfiguredException $e) {
$this->assertSame('Trying to configure method "doSomething" which cannot be configured because it does not exist, has not been specified, is final, or is static', $e->getMessage());

Expand Down
Loading

0 comments on commit 3c1f893

Please sign in to comment.