IcalHelperTest.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. App::uses('IcalHelper', 'Tools.View/Helper');
  3. App::uses('MyCakeTestCase', 'Tools.TestSuite');
  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.x
  14. * 2010-09-14 ms
  15. */
  16. class IcalHelperTest extends MyCakeTestCase {
  17. public $Ical;
  18. public function setUp() {
  19. parent::setUp();
  20. $this->Ical = new IcalHelper(new View(null));
  21. }
  22. public function tearDown() {
  23. parent::tearDown();
  24. }
  25. public function testObject() {
  26. $this->assertInstanceOf('IcalHelper', $this->Ical);
  27. }
  28. public function testAdd() {
  29. $data = array(
  30. 'url' => 'http://www.spiegel.de',
  31. 'start' => '2010-10-09 22:23:34',
  32. 'end' => '2010-10-09 23:23:34',
  33. 'summary' => 'xyz',
  34. 'description' => 'xyz hjdhfj dhfäöüp e',
  35. 'organizer' => 'CEO',
  36. 'class' => 'public',
  37. );
  38. $res = $this->Ical->add($data);
  39. $this->assertTrue($res);
  40. }
  41. public function testGenerate() {
  42. $data = array(
  43. 'url' => 'http://www.spiegel.de',
  44. 'start' => '2010-10-09 22:23:34',
  45. 'end' => '2010-10-09 23:23:34',
  46. 'summary' => 'xyz',
  47. 'description' => 'xyz hjdhfj dhfäöüp e',
  48. 'organizer' => 'CEO',
  49. 'class' => 'public',
  50. 'timestamp' => '2010-10-08 22:23:34',
  51. 'id' => String::uuid(),
  52. 'location' => 'München'
  53. );
  54. $this->Ical->add($data);
  55. $this->Ical->add($data);
  56. $res = $this->Ical->generate();
  57. //pr($res);
  58. }
  59. }