예제 #1
0
 /**
  *    Creates source code for chaining to an aggregated
  *    mock object.
  *    @return string                 Code for expectations.
  *    @access private
  */
 function _chainMockExpectations()
 {
     $code = "    function expectArguments(\$method, \$args = false) {\n";
     $code .= Mock::_bailOutIfNotMocked("\$method");
     $code .= "        \$this->_mock->expectArguments(\$method, \$args);\n";
     $code .= "    }\n";
     $code .= "    function expectArgumentsAt(\$timing, \$method, \$args = false) {\n";
     $code .= Mock::_bailOutIfNotMocked("\$method");
     $code .= "        \$this->_mock->expectArgumentsAt(\$timing, \$method, \$args);\n";
     $code .= "    }\n";
     $code .= "    function expectCallCount(\$method, \$count) {\n";
     $code .= Mock::_bailOutIfNotMocked("\$method");
     $code .= "        \$this->_mock->expectCallCount(\$method, \$count);\n";
     $code .= "    }\n";
     $code .= "    function expectMaximumCallCount(\$method, \$count) {\n";
     $code .= Mock::_bailOutIfNotMocked("\$method");
     $code .= "        \$this->_mock->expectMaximumCallCount(\$method, \$count);\n";
     $code .= "    }\n";
     $code .= "    function expectMinimumCallCount(\$method, \$count) {\n";
     $code .= Mock::_bailOutIfNotMocked("\$method");
     $code .= "        \$this->_mock->expectMinimumCallCount(\$method, \$count);\n";
     $code .= "    }\n";
     $code .= "    function expectNever(\$method) {\n";
     $code .= Mock::_bailOutIfNotMocked("\$method");
     $code .= "        \$this->_mock->expectNever(\$method);\n";
     $code .= "    }\n";
     $code .= "    function expectOnce(\$method, \$args = false) {\n";
     $code .= Mock::_bailOutIfNotMocked("\$method");
     $code .= "        \$this->_mock->expectOnce(\$method, \$args);\n";
     $code .= "    }\n";
     $code .= "    function expectAtLeastOnce(\$method, \$args = false) {\n";
     $code .= Mock::_bailOutIfNotMocked("\$method");
     $code .= "        \$this->_mock->expectAtLeastOnce(\$method, \$args);\n";
     $code .= "    }\n";
     $code .= "    function tally() {\n";
     $code .= "        \$this->_mock->tally();\n";
     $code .= "    }\n";
     return $code;
 }