| Conditions | 4 |
| Paths | 6 |
| Total Lines | 25 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | public static function create($name, \PHPUnit_Framework_TestCase $phpunit) |
||
| 11 | { |
||
| 12 | $methods = array(); |
||
| 13 | |||
| 14 | $ref = new \ReflectionClass($name); |
||
| 15 | foreach ($ref->getProperties() as $property) { |
||
| 16 | $methods[] = 'get' . ucfirst($property->name); |
||
| 17 | $methods[] = 'set' . ucfirst($property->name); |
||
| 18 | } |
||
| 19 | |||
| 20 | foreach ($ref->getMethods() as $method) { |
||
| 21 | |||
| 22 | // do not mock array object methods to we can iterate these mocks |
||
| 23 | if ($method->class === 'ArrayObject') { |
||
| 24 | continue; |
||
| 25 | } |
||
| 26 | |||
| 27 | $methods[] = $method->name; |
||
| 28 | } |
||
| 29 | |||
| 30 | return $phpunit->getMockBuilder($name) |
||
| 31 | ->disableOriginalConstructor() |
||
| 32 | ->setMethods($methods) |
||
| 33 | ->getMock(); |
||
| 34 | } |
||
| 35 | } |
||
| 36 |