IcalHelperTest.php 1.5 KB

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