/** * Test method for the <tt>addCondition($condition)</tt>, <tt>getConditions()</tt> and * <tt>setConditions($conditions)</tt> functions. */ public function testAddGetSetConditions() { // Test for 'addCondition' $notification = new Notification(); $condition0 = IntCondition::create('intTag')->eq(10); $condition1 = ListCondition::create('listTag')->in(array('value1', 'value2', 'value3')); $condition2 = StringCondition::create('stringTag')->eq('stringValue'); $this->assertNull($notification->getConditions()); $notification->addCondition($condition0); $notification->addCondition($condition1); $notification->addCondition($condition2); $conditions = $notification->getConditions(); $this->assertCount(3, $conditions); $this->assertSame($condition0, $conditions[0]); $this->assertSame($condition1, $conditions[1]); $this->assertSame($condition2, $conditions[2]); // Test for 'setConditions' $notification = new Notification(); $this->assertNull($notification->getConditions()); $notification->setConditions(array($condition0, $condition1, $condition2)); $conditions = $notification->getConditions(); $this->assertCount(3, $conditions); $this->assertSame($condition0, $conditions[0]); $this->assertSame($condition1, $conditions[1]); $this->assertSame($condition2, $conditions[2]); }