Esempio n. 1
0
 /**
  * @covers  JError::addToStack
  */
 public function testAddToStack()
 {
     // Remove the following lines when the framework is fixed.
     //$this->markTestSkipped('The framework is currently broken.  Skipping this test.');
     JErrorInspector::manipulateStack(array('value1', 'value2', 'value3'));
     $exception = new JException('This is the error message', 1056, 'error');
     JError::addToStack($exception);
     $stack = JErrorInspector::inspectStack();
     $this->assertThat($stack[3], $this->identicalTo($exception), 'The exception did not get properly added to the stack');
     JErrorInspector::manipulateStack(array());
 }
Esempio n. 2
0
 /**
  * @todo Implement testGetError().
  */
 public function testGetError()
 {
     JErrorInspector::manipulateStack(array());
     $this->assertThat(JError::getError(), $this->isFalse(), 'There was no error on the error stack but getError did not return false');
     // we normally couldn't have strings, but this is only a test
     JErrorInspector::manipulateStack(array('Error1', 'Error2'));
     $this->assertThat(JError::getError(), $this->equalTo('Error1'), 'We did not get the proper value back from getError - it should have returned our fake error');
     $this->assertThat(JErrorInspector::inspectStack(), $this->equalTo(array('Error1', 'Error2')), 'The stack was changed by getError even though unset was false');
     $this->assertThat(JError::getError(true), $this->equalTo('Error1'), 'We did not get the proper value back from getError - it should have returned our fake error');
     $this->assertThat(JErrorInspector::inspectStack(), $this->equalTo(array('Error2')), 'The stack was either not changed or changed the wrong way by getError (with  unset true)');
     // here we remove any junk left on the error stack
     JErrorInspector::manipulateStack(array());
 }