Jarves\Tests\Configuration\EventTest::testConditionEventObject PHP Method

testConditionEventObject() public method

    public function testConditionEventObject()
    {
        $xml = '<event key="core/test" subject="foo">
  <call>Jarves\\Tests\\Configuration\\EventTest::fireEvent</call>
  <condition>
    <rule key="field1" type="equal">value</rule>
    <and/>
    <rule key="field2" type="greater">2</rule>
    <and/>
    <group>
      <rule key="field3" type="equal">1</rule>
      <or/>
      <rule key="field3" type="equal">1002</rule>
    </group>
  </condition>
</event>';
        $event = new Event($xml, $this->getJarves());
        $array = ['key' => 'core/test', 'subject' => 'foo', 'calls' => ['Jarves\\Tests\\Configuration\\EventTest::fireEvent'], 'condition' => [['field1', 'equal', 'value'], 'and', ['field2', 'greater', '2'], 'and', [['field3', 'equal', 1], 'or', ['field3', 'equal', 1002]]]];
        $eventArray = new Event($array, $this->getJarves());
        $this->assertEquals($xml, $event->toXml());
        $this->assertEquals($array, $event->toArray());
        $this->assertEquals($xml, $eventArray->toXml());
        $this->assertEquals($array, $eventArray->toArray());
    }