Permalink
Browse files

Adding test case for FirePHP toolbar use on Ajax requests

  • Loading branch information...
1 parent 5bee765 commit 02f057aa0c6aa287f6896af9e5cc2a80153ac2dd @markstory markstory committed Jan 8, 2009
Showing with 13 additions and 3 deletions.
  1. +13 −3 tests/cases/controllers/components/toolbar.test.php
@@ -29,11 +29,9 @@
App::import('Component', 'DebugKit.Toolbar');
class TestToolbarComponent extends ToolbarComponent {
-
function loadPanels($panels) {
$this->_loadPanels($panels);
}
-
}
Mock::generate('DebugPanel');
@@ -306,7 +304,19 @@ function testLogPanel() {
$this->assertEqual(trim($result['content']['debug.log'][1]), 'Debug: This time in the debug log!');
$this->assertEqual(trim($result['content']['error.log'][1]), 'Error: This is a log I made this request');
}
-
+/**
+ * Test that the FireCake toolbar is used on AJAX requests
+ *
+ * @return void
+ **/
+ function testAjaxToolbar() {
+ $_SERVER['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest';
+ $this->Controller->components = array('DebugKit.Toolbar');
+ $this->Controller->Component->init($this->Controller);
+ $this->Controller->Component->initialize($this->Controller);
+ $this->Controller->Component->startup($this->Controller);
+ $this->assertEqual($this->Controller->helpers['DebugKit.Toolbar']['output'], 'DebugKit.FirePhpToolbar');
+ }
/**
* teardown

0 comments on commit 02f057a

Please sign in to comment.