protected function doFixture($method) { $name = $this->name === "" ? get_class($this) : $this->name; $fixtureDir = RUN_BASE . DS . "tests" . DS . "fixture"; $reflection = new Sabel_Reflection_Class($name); $annotation = $reflection->getAnnotation("fixture"); if (isset($annotation[0])) { if ($method === "downFixture") { $annotation[0] = array_reverse($annotation[0]); } try { foreach ($annotation[0] as $fixtureName) { Sabel::fileUsing($fixtureDir . DS . $this->getFixturePath($fixtureName), true); $className = "Fixture_" . $fixtureName; $fixture = new $className(); $fixture->{$method}(); } } catch (Exception $e) { if ($reflection->hasMethod($method . "Exception")) { $reflection->getMethod($method . "Exception")->invoke(null, $e); } else { throw $e; } } } }
public function __call($method, $arg) { $reflection = new Sabel_Reflection_Class($this->target); if ($this->checkTargetMethod && !$reflection->hasMethod($method)) { throw new Sabel_Aspect_Exception_MethodNotFound($method . " not found"); } $this->invocation->reset($method, $arg); $advices = array(); $pointcuts = new Sabel_Aspect_DefaultPointcuts(); foreach ($this->advisor as $advisor) { $pointcut = $advisor->getPointcut(); if (!$pointcut instanceof Sabel_Aspect_Pointcut) { throw new Sabel_Exception_Runtime("pointcut must be Sabel_Aspect_Pointcut"); } if ($pointcuts->matches($pointcut, $method, $this->target)) { $advice = $advisor->getAdvice(); if (is_array($advice)) { $advices = array_merge($advice, $advices); } else { $advices[] = $advice; } } } if (count($advices) >= 1) { $this->invocation->setAdvices($advices); } return $this->invocation->proceed(); }
public function __call($method, $arg) { $reflection = new Sabel_Reflection_Class($this->target); if ($this->checkTargetMethod && !$reflection->hasMethod($method)) { throw new Sabel_Aspect_Exception_MethodNotFound($method . " not found"); } $this->invocation->reset($method, $arg); if ($this->adviced->hasAdvice($method)) { $this->invocation->setAdvices($this->adviced->getAdvice($method)); } return $this->invocation->proceed(); }