| Conditions | 3 |
| Paths | 4 |
| Total Lines | 19 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 14 |
| CRAP Score | 3 |
| Changes | 2 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 10 | 19 | public static function mock($name, \PHPUnit_Framework_TestCase $phpunit) |
|
|
|
|||
| 11 | { |
||
| 12 | 19 | $methods = array(); |
|
| 13 | |||
| 14 | 19 | $ref = new \ReflectionClass($name); |
|
| 15 | 19 | foreach ($ref->getProperties() as $property) { |
|
| 16 | 17 | $methods[] = 'get' . ucfirst($property->name); |
|
| 17 | 17 | $methods[] = 'set' . ucfirst($property->name); |
|
| 18 | 19 | } |
|
| 19 | |||
| 20 | 19 | foreach ($ref->getMethods() as $method) { |
|
| 21 | 19 | $methods[] = $method->name; |
|
| 22 | 19 | } |
|
| 23 | |||
| 24 | 19 | return $phpunit->getMockBuilder($name) |
|
| 25 | 19 | ->disableOriginalConstructor() |
|
| 26 | 19 | ->setMethods($methods) |
|
| 27 | 19 | ->getMock(); |
|
| 28 | } |
||
| 29 | } |
||
| 30 |