PluginPlayvideosTest.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. /**
  3. * PluginPlayvideosTest.php
  4. */
  5. require_once 'plugins/playvideos/playvideos.php';
  6. require_once 'application/Router.php';
  7. /**
  8. * Class PluginPlayvideosTest
  9. * Unit test for the PlayVideos plugin
  10. */
  11. class PluginPlayvideosTest extends PHPUnit_Framework_TestCase
  12. {
  13. /**
  14. * Reset plugin path
  15. */
  16. public function setUp()
  17. {
  18. PluginManager::$PLUGINS_PATH = 'plugins';
  19. }
  20. /**
  21. * Test render_linklist hook.
  22. */
  23. public function testPlayvideosHeader()
  24. {
  25. $str = 'stuff';
  26. $data = array($str => $str);
  27. $data['_PAGE_'] = Router::$PAGE_LINKLIST;
  28. $data = hook_playvideos_render_header($data);
  29. $this->assertEquals($str, $data[$str]);
  30. $this->assertEquals(1, count($data['buttons_toolbar']));
  31. $data = array($str => $str);
  32. $data['_PAGE_'] = $str;
  33. $this->assertEquals($str, $data[$str]);
  34. $this->assertArrayNotHasKey('buttons_toolbar', $data);
  35. }
  36. /**
  37. * Test render_footer hook.
  38. */
  39. public function testPlayvideosFooter()
  40. {
  41. $str = 'stuff';
  42. $data = array($str => $str);
  43. $data['_PAGE_'] = Router::$PAGE_LINKLIST;
  44. $data = hook_playvideos_render_footer($data);
  45. $this->assertEquals($str, $data[$str]);
  46. $this->assertEquals(2, count($data['js_files']));
  47. $data = array($str => $str);
  48. $data['_PAGE_'] = $str;
  49. $this->assertEquals($str, $data[$str]);
  50. $this->assertArrayNotHasKey('js_files', $data);
  51. }
  52. }