IcalHelperTest.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. App::import('Helper', 'Tools.Ical');
  3. App::uses('MyCakeTestCase', 'Tools.Lib');
  4. App::uses('String', 'Utility');
  5. App::uses('View', 'View');
  6. /**
  7. * A wrapper for the Ical/Ics calendar lib
  8. * @uses Tools.IcalLib
  9. * @see http://www.dereuromark.de/2011/11/21/serving-views-as-files-in-cake2 for details
  10. *
  11. * @author Mark Scherer
  12. * @license MIT
  13. * @cakephp 2.0
  14. * 2010-09-14 ms
  15. */
  16. class IcalHelperTest extends MyCakeTestCase {
  17. public $Ical;
  18. public function setUp() {
  19. $this->Ical = new IcalHelper(new View(null));
  20. }
  21. public function tearDown() {
  22. }
  23. public function testObject() {
  24. $this->assertTrue(is_a($this->Ical, 'IcalHelper'));
  25. }
  26. public function testAdd() {
  27. $data = array(
  28. 'url' => 'http://www.spiegel.de',
  29. 'start' => '2010-10-09 22:23:34',
  30. 'end' => '2010-10-09 23:23:34',
  31. 'summary' => 'xyz',
  32. 'description' => 'xyz hjdhfj dhfäöüp e',
  33. 'organizer' => 'CEO',
  34. 'class' => 'public',
  35. );
  36. $res = $this->Ical->add($data);
  37. $this->assertTrue($res);
  38. }
  39. public function testGenerate() {
  40. $data = array(
  41. 'url' => 'http://www.spiegel.de',
  42. 'start' => '2010-10-09 22:23:34',
  43. 'end' => '2010-10-09 23:23:34',
  44. 'summary' => 'xyz',
  45. 'description' => 'xyz hjdhfj dhfäöüp e',
  46. 'organizer' => 'CEO',
  47. 'class' => 'public',
  48. 'timestamp' => '2010-10-08 22:23:34',
  49. 'id' => String::uuid(),
  50. 'location' => 'München'
  51. );
  52. $this->Ical->add($data);
  53. $this->Ical->add($data);
  54. $res = $this->Ical->generate();
  55. pr($res);
  56. ob_flush();
  57. }
  58. }