/** * Returns all NotificationTypeAttributes to be registered with the sfNotificationsPlugin. * * @return NotificationTypeAttributeCollection */ public static function getAttributeCollection() { $collection = new NotificationTypeAttributeCollection(); $subject = new NotificationTypeAttribute(); $subject->setName('subject')->setDisplayName('Subject'); $collection->add($subject); $recipient = new NotificationTypeAttribute(); $recipient->setName('recipient')->setDisplayName('Recipient'); $collection->add($recipient); return $collection; }
/** * @depends testAddTwoIterator */ public function testAddThreeRemoveIntermediateIterator() { $attribute1 = new NotificationTypeAttribute(); $attribute1->setName('First'); $index1 = $this->collection->add($attribute1); $attribute2 = new NotificationTypeAttribute(); $attribute2->setName('Second'); $index2 = $this->collection->add($attribute2); $attribute3 = new NotificationTypeAttribute(); $attribute3->setName('Third'); $index3 = $this->collection->add($attribute3); $this->collection->remove($index2); $this->assertEquals(2, count($this->collection)); $expectation = array(0 => 'First', 1 => 'Third'); $c = 0; foreach ($this->collection as $attribute) { /* @var $attribute NotificationTypeAttribute */ $this->assertEquals($expectation[$c], $attribute->getName()); $c++; } $this->assertEquals(2, $c, 'Not all elements have been checked.'); }
/** * Returns all NotificationTypeAttributes to be registered with the sfNotificationsPlugin. * * @return NotificationTypeAttributeCollection */ public static function getAttributeCollection() { $filenameAttribute = new NotificationTypeAttribute(); $filenameAttribute->setName('filename'); $collection = new NotificationTypeAttributeCollection(); return $collection->add($filenameAttribute); }