Skip to content

Commit

Permalink
- Fix #140.
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Jun 23, 2007
1 parent 05bbd61 commit fd9ce9a
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions PHPUnit/Framework/MockObject/Mock.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,19 +193,28 @@ protected function generateClassDefinition(ReflectionClass $class)
);
}

$code .= $this->generateMockApi($class);
$code .= $this->generateMockApi($class);
$methods = array_unique(array_merge($this->methods, get_class_methods($class->getName())));

foreach ($this->methods as $methodName) {
try {
$method = $class->getMethod($methodName);
foreach ($methods as $methodName) {
if (in_array($methodName, $this->methods)) {
try {
$method = $class->getMethod($methodName);

if ($this->canMockMethod($method)) {
$code .= $this->generateMethodDefinitionFromExisting($method);
if ($this->canMockMethod($method)) {
$code .= $this->generateMethodDefinitionFromExisting($method);
}
}
}

catch (ReflectionException $e) {
$code .= $this->generateMethodDefinition($class->getName(), $methodName, 'public');
catch (ReflectionException $e) {
$code .= $this->generateMethodDefinition($this->className, $methodName, 'public');
}
} else {
$code .= "\n" . str_replace(
array($this->className . '::', 'self::'),
$this->mockClassName . '::',
PHPUnit_Util_Class::getMethodSource($this->className, $methodName)
);
}
}

Expand Down

0 comments on commit fd9ce9a

Please sign in to comment.