diff --git a/src/TUnit/framework/mock/InvocationTracker.php b/src/TUnit/framework/mock/InvocationTracker.php new file mode 100644 index 0000000..a4e7b7f --- /dev/null +++ b/src/TUnit/framework/mock/InvocationTracker.php @@ -0,0 +1,17 @@ +invocations = array(); + } + + public function registerInvocation(MockInvocation $invocation) { + $this->invocations[] = $invocation; + } + + } + +?> \ No newline at end of file diff --git a/src/TUnit/framework/mock/MockInvocation.php b/src/TUnit/framework/mock/MockInvocation.php new file mode 100644 index 0000000..3056caa --- /dev/null +++ b/src/TUnit/framework/mock/MockInvocation.php @@ -0,0 +1,23 @@ +method = $methodName; + $this->args = $args; + } + + public function getMethod() { + return $this->method; + } + + public function getArgs() { + return $this->args; + } + + } + +?> \ No newline at end of file diff --git a/src/TUnit/framework/mock/MockObject.php b/src/TUnit/framework/mock/MockObject.php index 21c7dd5..bc321da 100644 --- a/src/TUnit/framework/mock/MockObject.php +++ b/src/TUnit/framework/mock/MockObject.php @@ -32,12 +32,12 @@ ); } - public static function registerInvocation($name, MockInvocation $invocation) { - if (!isset(self::$registry[$name])) { + public static function registerInvocation($className, $methodName, array $args) { + if (!isset(self::$registry[$className])) { throw new LogicException('Unable to register invocation because the object does not exist in the registry'); } - self::$registry[$name]->registerInvocation($invocation); + self::$registry[$className]->registerInvocation(new MockInvocation($methodName, $args)); } public static function getTracker($name) { @@ -50,7 +50,6 @@ public function addMethod($methodName, $callParent = false, $body = '') { $methodType = 'generic'; - if ($this->referenceObject->hasMethod($methodName)) { $method = $this->referenceObject->getMethod($methodName); if (!$this->methodIsMockable($method)) diff --git a/src/TUnit/framework/mock/Verifiable.php b/src/TUnit/framework/mock/Verifiable.php new file mode 100644 index 0000000..6475600 --- /dev/null +++ b/src/TUnit/framework/mock/Verifiable.php @@ -0,0 +1,9 @@ + \ No newline at end of file diff --git a/src/TUnit/manifest.php b/src/TUnit/manifest.php index 01a0fdf..5a52539 100644 --- a/src/TUnit/manifest.php +++ b/src/TUnit/manifest.php @@ -3,7 +3,7 @@ /** * Autoload manifest * - * Autogenerated by manifester.php on 2009-06-13 19:56:43 + * Autogenerated by manifester.php on 2009-06-15 20:40:53 * * @package TUnit * @version 0.1.0 @@ -30,7 +30,11 @@ 'IdenticalConstraint' => 'TUnit/framework/constraints/IdenticalConstraint.php', 'IgnoredTest' => 'TUnit/framework/result/FailedTest.php', 'IgnoredTestResult' => 'TUnit/framework/result/IgnoredTestResult.php', + 'InvocationTracker' => 'TUnit/framework/mock/InvocationTracker.php', 'IssetConstraint' => 'TUnit/framework/constraints/SimpleConstraints.php', + 'MockInvocation' => 'TUnit/framework/mock/MockInvocation.php', + 'MockObject' => 'TUnit/framework/mock/MockObject.php', + 'MockObjectCreator' => 'TUnit/framework/mock/MockObject.php', 'NotConstraint' => 'TUnit/framework/constraints/NotConstraint.php', 'NullConstraint' => 'TUnit/framework/constraints/SimpleConstraints.php', 'PassedTestResult' => 'TUnit/framework/result/PassedTestResult.php', @@ -48,7 +52,8 @@ 'Testable' => 'TUnit/framework/test/Testable.php', 'TrueConstraint' => 'TUnit/framework/constraints/SimpleConstraints.php', 'Usage' => 'TUnit/util/cli.php', - 'Util' => 'TUnit/util/Util.php' + 'Util' => 'TUnit/util/Util.php', + 'Verifiable' => 'TUnit/framework/mock/Verifiable.php' ); ?> \ No newline at end of file