Example #1
0
 /**
  * prepareRoute
  *
  * @param Mock  $route
  * @param array $def
  * @param array $const
  *
  * @return void
  */
 private function prepareRoute($route, array $def = null, array $const = null)
 {
     if (null !== $def) {
         $route->method('getDefaults')->willReturn($def);
         $dmap = [];
         foreach ($def as $key => $value) {
             $dmap[] = [$key, $value];
         }
         $route->method('getDefault')->will($this->returnValueMap($dmap));
     }
     if (null !== $const) {
         $route->method('getConstraints')->willReturn($const);
         $cmap = [];
         foreach ($const as $key => $value) {
             $cmap[] = [$key, $value];
         }
         $route->method('getConstraint')->will($this->returnValueMap($cmap));
     }
 }
Example #2
0
 public function test_calling_method_with_no_parameters()
 {
     $mock = new Mock('Test');
     $mock->expects('method')->returns("returned data");
     $this->assertEquals("returned data", $mock->method());
     $this->assertTrue(Mock::verifyAll());
 }