/** * @test */ public function doesNotHaveProperty() { $action = new Action("profile_updated"); $this->assertThat($action->hasProperty("profile_slug"), $this->isFalse()); $this->assertThat($action->getProperty("profile_slug"), $this->isNull()); $this->assertThat($action->getProperty("profile_slug", "defaultValue"), $this->equalTo("defaultValue")); }
/** * @param Action $action * @return bool */ public function matches($action) { // validates on action name foreach ($this->matchersOnActionName as $matcher) { if (!$matcher->matches($action->getName())) { return false; } } // validates on properties foreach ($this->matchersOnPropertyName as $propertyName => $matcher) { if (!$matcher->matches($action->getProperty($propertyName))) { return false; } } return true; }