PHPUnit_Extensions_OutputTestCase::expectOutputString PHP Méthode

expectOutputString() public méthode

public expectOutputString ( string $expectedString )
$expectedString string
    public function expectOutputString($expectedString)
    {
        if ($this->expectedRegex !== NULL) {
            throw new PHPUnit_Framework_Exception();
        }
        if (is_string($expectedString) || is_null($expectedString)) {
            $this->expectedString = $expectedString;
        }
    }

Usage Example

 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();
 }