Пример #1
0
 /**
  * They're equal if this is the same type of event and the same id
  * Allows to know if an event concerns a same type of action on the same object.
  * Very useful to delete doubles.
  *
  * @param  Event $event
  * @return boolean
  */
 public function isEqual(Event $event)
 {
     try {
         return $this->getName() === $event->getName() && $this->get('id') === $event->get('id') && self::getSortedKeys($this->getParameters()) === self::getSortedKeys($event->getParameters());
     } catch (\Exception $e) {
     }
     return false;
 }
Пример #2
0
 /**
  * @test
  */
 public function it_should_be_possible_to_build_an_event_from_json_without_params()
 {
     $jsonEvent = json_encode(array('name' => 'eventName'));
     $event = Event::fromJson($jsonEvent);
     $this->assertEquals(new Event('eventName'), $event);
 }