Ejemplo n.º 1
0
 public function testAll()
 {
     $stream = tmpfile();
     $cli = new Cli($stream);
     $called = false;
     $returnedCli = $cli->setWindowWidthGetter(function () use(&$called) {
         $called = true;
         return 35;
     });
     $this->assertSame($cli, $returnedCli);
     $cli->displayException(new \Exception(__FILE__));
     $streamObj = new Stream($stream);
     $output = $streamObj->getContents();
     $this->assertTrue($called);
     $this->assertContains(__FILE__, $output);
     $this->assertContains(str_pad('', 35, '#'), $output);
 }
Ejemplo n.º 2
0
 /**
  * @param Editors\EditorInterface|null $editor
  * @return Dumpers\DumperInterface
  */
 private static function createDumperBySapiName(Editors\EditorInterface $editor = null)
 {
     if (php_sapi_name() === 'cli') {
         $dumper = new Dumpers\Cli(fopen('php://output', 'w'));
         $dumper->setWindowWidthGetter(function () {
             return (int) exec('tput cols') ?: Dumpers\Cli::EMPHASIS_LENGTH;
         });
         return $dumper;
     }
     is_null($editor) && ($editor = new Editors\PhpStorm());
     return new Dumpers\Html($editor, fopen('php://output', 'w'));
 }