Example #1
0
 public function testBadRoute()
 {
     $baseModel = m::mock('Spira\\Core\\Model\\Model\\BaseModel')->makePartial();
     RouteHelper::getRoute($baseModel);
     $this->assertTrue(RouteHelper::$badRoutes[get_class($baseModel)]);
 }
 /**
  * Recursive adding of self key.
  * @param BaseModel $model
  * @param $array
  * @return array
  */
 protected function addSelfKey(BaseModel $model, $array)
 {
     if ($route = RouteHelper::getRoute($model)) {
         $array = ['_self' => $route] + $array;
     }
     return $array;
 }