Skip to content

Commit

Permalink
Use consistent variable name
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Dec 11, 2024
1 parent 7195d43 commit 2ad0441
Show file tree
Hide file tree
Showing 8 changed files with 138 additions and 138 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
10 changes: 5 additions & 5 deletions tests/unit/Framework/MockObject/Creation/CreateTestProxyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ final class CreateTestProxyTest extends TestCase
{
public function testCreatesTestProxyForExtendableClass(): void
{
$proxy = $this->createTestProxy(TestProxyFixture::class);
$double = $this->createTestProxy(TestProxyFixture::class);

$proxy->expects($this->once())
$double->expects($this->once())
->method('returnString');

assert($proxy instanceof MockObject);
assert($proxy instanceof TestProxyFixture);
assert($double instanceof MockObject);
assert($double instanceof TestProxyFixture);

$this->assertSame('result', $proxy->returnString());
$this->assertSame('result', $double->returnString());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ final class GetMockForAbstractClassTest extends TestCase
{
public function testCreatesMockObjectForAbstractClassAndAllowsConfigurationOfAbstractMethods(): void
{
$mock = $this->getMockForAbstractClass(AbstractClass::class);
$double = $this->getMockForAbstractClass(AbstractClass::class);

$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 testCannotCreateMockObjectForAbstractClassThatDoesNotExist(): void
Expand All @@ -45,10 +45,10 @@ public function testCannotCreateMockObjectForAbstractClassThatDoesNotExist(): vo

public function testCreatesMockObjectForAbstractClassAndDoesNotAllowConfigurationOfConcreteMethods(): void
{
$mock = $this->getMockForAbstractClass(AbstractClass::class);
$double = $this->getMockForAbstractClass(AbstractClass::class);

try {
$mock->expects($this->once())->method('doSomething');
$double->expects($this->once())->method('doSomething');
} 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
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ final class GetMockForTraitTest extends TestCase
{
public function testCreatesMockObjectForTraitAndAllowsConfigurationOfAbstractMethods(): void
{
$mock = $this->getMockForTrait(TraitWithConcreteAndAbstractMethod::class);
$double = $this->getMockForTrait(TraitWithConcreteAndAbstractMethod::class);

$mock->method('abstractMethod')->willReturn(true);
$double->method('abstractMethod')->willReturn(true);

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

public function testCannotCreateMockObjectForTraitThatDoesNotExist(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ final class GetMockFromWsdlTest extends TestCase
#[TestDox('Creates mock object from WSDL file')]
public function test_CreatesMockObjectFromWsdlFileWithNonNamespacedClassName(): void
{
$mock = $this->getMockFromWsdl(TEST_FILES_PATH . 'GoogleSearch.wsdl');
$double = $this->getMockFromWsdl(TEST_FILES_PATH . 'GoogleSearch.wsdl');

$this->assertStringStartsWith(
'MockObject_GoogleSearch_',
$mock::class,
$double::class,
);
}
}
Loading

0 comments on commit 2ad0441

Please sign in to comment.