EventObjectTest.php 928B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. require_once 'Swift/Tests/SwiftUnitTestCase.php';
  3. require_once 'Swift/Events/EventObject.php';
  4. class Swift_Events_EventObjectTest extends Swift_Tests_SwiftUnitTestCase
  5. {
  6. public function testEventSourceCanBeReturnedViaGetter()
  7. {
  8. $source = new stdClass();
  9. $evt = $this->_createEvent($source);
  10. $ref = $evt->getSource();
  11. $this->assertReference($source, $ref);
  12. }
  13. public function testEventDoesNotHaveCancelledBubbleWhenNew()
  14. {
  15. $source = new stdClass();
  16. $evt = $this->_createEvent($source);
  17. $this->assertFalse($evt->bubbleCancelled());
  18. }
  19. public function testBubbleCanBeCancelledInEvent()
  20. {
  21. $source = new stdClass();
  22. $evt = $this->_createEvent($source);
  23. $evt->cancelBubble();
  24. $this->assertTrue($evt->bubbleCancelled());
  25. }
  26. // -- Creation Methods
  27. private function _createEvent($source)
  28. {
  29. return new Swift_Events_EventObject($source);
  30. }
  31. }