Skip to content
This repository was archived by the owner on May 13, 2024. It is now read-only.

Commit fcf5a48

Browse files
committed
Adds method to get a MockTestCase to AbstractTraitShim test.
1 parent 854f8ad commit fcf5a48

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

tests/unit/Shim/AbstractTraitShimTest.php

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,7 @@ final public function testShimShouldBeInstantiatedWhenGivenTestCase()
6161
$calledClass = get_called_class();
6262
$calledClass = substr($calledClass, 0, -4); // 4 = strlen('Test')
6363

64-
$mockName = class_exists('\PHPUnit_Framework_TestCase')
65-
? '\PHPUnit_Framework_TestCase'
66-
: '\PHPUnit\Framework\TestCase'
67-
;
68-
69-
$mockTestCase = $this->getMockBuilder($mockName)->disableOriginalConstructor()->getMockForAbstractClass();
64+
$mockTestCase = $this->getMockTestCase();
7065

7166
$shim = new $calledClass($mockTestCase);
7267

@@ -149,6 +144,22 @@ final public function testShim_Should_When_GetExistingClassName()
149144
{
150145
$this->markTestIncomplete('@TODO: Write tests for \Potherca\PhpUnit\Shim\AbstractTraitShim::getExistingClassName()');
151146
}
147+
148+
////////////////////////////// MOCKS AND STUBS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\
149+
150+
/**
151+
* @return mixed
152+
*/
153+
final public function getMockTestCase()
154+
{
155+
$mockName = class_exists('\PHPUnit_Framework_TestCase')
156+
? '\PHPUnit_Framework_TestCase'
157+
: '\PHPUnit\Framework\TestCase';
158+
159+
$mockTestCase = $this->getMockBuilder($mockName)->disableOriginalConstructor()->getMockForAbstractClass();
160+
161+
return $mockTestCase;
162+
}
152163
}
153164

154165
/*EOF*/

0 commit comments

Comments
 (0)