<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>tests/mock/defaults.stest.php</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -404,7 +404,7 @@ class Snap_MockObject {
                 $returns_at_default[] = $sig;
             }
         }
-        
+
         // &gt; 1 return is an exception
         if (count($returns_at_call_count) &gt; 1) {
             // error here
@@ -525,16 +525,29 @@ class Snap_MockObject {
                 continue;
             }
             
+            // look at every param submitted versus the params in the signature
+            // once we have a non-match, we fail out the test.
+            // if we get all the way through then add the signature to our
+            // match list
             $param_match = TRUE;
             foreach ($params as $idx =&gt; $param) {
-                // more params in sig than sent to us
-                if (!in_array($idx, array_keys($method_params))) {
+                // more params in sig than sent to us, and this wasn't an anything expectation
+                if (!in_array($idx, array_keys($method_params)) &amp;&amp; is_object($param) &amp;&amp; strtolower(get_class($param)) != 'snap_anything_expectation') {
                     $param_match = FALSE;
                     break;
                 }
                 
+                // if this is an anything expectation, and there was no param (optional),
+                // make the method param anything we want.
+                if (strtolower(get_class($param)) == 'snap_anything_expectation' &amp;&amp; !isset($method_params[$idx])) {
+                    $method_param = NULL;
+                }
+                else {
+                    $method_param = $method_params[$idx];
+                }
+                
                 // run a match, if it fails, it is a non match
-                if (!$param-&gt;match($method_params[$idx])) {
+                if (!$param-&gt;match($method_param)) {
                     $param_match = FALSE;
                     break;
                 }
@@ -562,6 +575,7 @@ class Snap_MockObject {
         if (!isset($this-&gt;signatures[$method_name])) {
             return NULL;
         }
+
         foreach ($this-&gt;signatures[$method_name] as $signature =&gt; $details) {
             if (count($details['params']) == 0) {
                 return $signature;</diff>
      <filename>core/mock/mock.php</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>4f612243f2ec94f5e0994b44450657110bb8693f</id>
    </parent>
  </parents>
  <author>
    <name>Jakob Heuser</name>
    <email>jakob@felocity.org</email>
  </author>
  <url>http://github.com/Jakobo/snaptest/commit/c0205490f0a3df909b635072e8fdda385972a878</url>
  <id>c0205490f0a3df909b635072e8fdda385972a878</id>
  <committed-date>2008-08-19T11:11:19-07:00</committed-date>
  <authored-date>2008-08-19T11:11:19-07:00</authored-date>
  <message>fixed bug where mock objects were unable to return a proper signature with optional parameters

Signed-off-by: Jakob Heuser &lt;jakob@felocity.org&gt;</message>
  <tree>5db7bffc5ffcde48ded6c1be1928627abc38ff2d</tree>
  <committer>
    <name>Jakob Heuser</name>
    <email>jakob@felocity.org</email>
  </committer>
</commit>
