Author: Sebastian Bergmann (sb@sebastian-bergmann.de)
Inheritance: extends PHPUnit_Framework_TestCase
コード例 #1
0
 public function __construct()
 {
     parent::__construct();
     $this->runkitExt = false;
     if (function_exists("runkit_constant_redefine")) {
         $this->runkitExt = true;
     }
     $this->apdExt = false;
     if (function_exists("rename_function")) {
         $this->apdExt = true;
     }
     if ($this->apdExt && !$GLOBALS['test_header']) {
         // using apd extension to overriding header and headers_sent functions for test purposes
         $GLOBALS['test_header'] = 1;
         // rename_function() of header and headers_sent may cause CLI error report in Windows XP
         rename_function('header', 'test_header');
         rename_function('headers_sent', 'test_headers_sent');
         // solution from: http://unixwars.com/2008/11/29/override_function-in-php/ to overriding more than one function
         $substs = array('header' => 'if (isset($GLOBALS["header"])) $GLOBALS["header"] .= $a; else $GLOBALS["header"] = $a;', 'headers_sent' => 'return false;');
         $args = array('header' => '$a', 'headers_sent' => '');
         foreach ($substs as $func => $ren_func) {
             if (function_exists("__overridden__")) {
                 rename_function("__overridden__", str_replace(array('.', ' '), array('', ''), microtime()));
             }
             override_function($func, $args[$func], $substs[$func]);
             rename_function("__overridden__", str_replace(array('.', ' '), array('', ''), microtime()));
         }
     }
 }
コード例 #2
0
ファイル: JLogTest.php プロジェクト: raquelsa/Joomla
 /**
  * Overrides the parent tearDown method.
  *
  * @return  void
  *
  * @see     PHPUnit_Framework_TestCase::tearDown()
  * @since   11.1
  */
 protected function tearDown()
 {
     // Clear out the log instance.
     $log = new JLogInspector();
     JLog::setInstance($log);
     parent::tearDown();
 }
コード例 #3
0
ファイル: SugarTestHelper.php プロジェクト: sunmo/snowlotus
 protected function runTest()
 {
     $testResult = parent::runTest();
     if ($this->_outputCheck) {
         $this->assertTrue(call_user_func($this->_outputCheck, $this->output));
     }
     return $testResult;
 }
コード例 #4
0
 public function testUserArchiveReportCommand() {
   global $l_id, $l_login, $l_lastname, $l_firstname, $l_archive, $l_timeupdate;
   ob_start();
   $cmd = new UserArchiveReportCommand();
   $cmd->doIt();
   PHPUnit_Extensions_OutputTestCase::expectOutputString($rep);
   $mailData = Stato_StaticTransport::getMailQ();
   $this->assertEquals('Rapport d\'exploitation : Liste des utilisateurs en archive',$mailData[0]['subject']);
   $this->assertEquals("domainezz.com Admin <*****@*****.**>", $mailData[0]['to']);
   $this->assertContains("Rapport d'exploitation du traitement \"Liste des utilisateurs en archive\" :\n"
                        ."\n"
                        ."$l_id\t$l_login\t$l_lastname\t$l_firstname\t$l_archive\t$l_timeupdate\t\n"
                        ."3\tuser1\tDoe\tJohn\t1\t2026-11-08 13:45:00\t\n"
                        ,$mailData[0]['content']);
   ob_clean();
   ob_end_flush();
 }