/** * Component constructor should accept an array of properties and * if it needs several instances of the same property it should be able to accept * an array inside of the array. */ public function testConstructorAcceptsInitializingArrayOfArrays() { $journal = new qCal_Component_Vjournal(array('attach' => array('http://www.example.com/foo/bar.mp3', 'http://www.example.com/foo/baz.mp3'))); $this->assertEqual(count($journal->getProperty('attach')), 2); }
/** * Test that all of the right characters are escaped when rendered * @todo Need to make sure that when parsing the escape characters are removed. */ public function testCharactersAreEscaped() { $journal = new qCal_Component_Vjournal(array('summary' => 'The most interesting, but non-interesting journal entry ever.', 'description' => 'This is a sentence that ends with a semi-colon, which I\'m not sure needs to be escaped; I will read the RFC a bit and find out what, exactly, needs to escaped. I know commas do though, and this entry has plenty of those.', 'dtstart' => qCal_DateTime::factory('20090809T113500'))); $this->assertEqual($journal->render(), "BEGIN:VJOURNAL\r\nSUMMARY:The most interesting\\, but non-interesting journal entry ever.\r\nDESCRIPTION:This is a sentence that ends with a semi-colon\\, which I'm not \r\n sure needs to be escaped; I will read the RFC a bit and find out what\\, exa\r\n ctly\\, needs to escaped. I know commas do though\\, and this entry has plent\r\n y of those.\r\nDTSTART:20090809T113500\r\nEND:VJOURNAL\r\n"); }
/** * The "VALARM" calendar component MUST only appear within either a * "VEVENT" or "VTODO" calendar component. */ public function testValarmCanOnlyAppearInVeventOrVtodo() { $alarm = new qCal_Component_Valarm(array('action' => 'audio', 'trigger' => 'P15M')); $alarm2 = new qCal_Component_Valarm(array('action' => 'audio', 'trigger' => 'P25M')); $journal = new qCal_Component_Vjournal(array('summary' => 'Some silly entry', 'description' => 'Some silly description')); $this->expectException(new qCal_Exception_InvalidComponent('VALARM cannot be attached to VJOURNAL')); $journal->attach($alarm); }