Ejemplo n.º 1
0
 /**
  * @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"));
 }
Ejemplo n.º 2
0
 /**
  * @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;
 }