/** @test */
 public function it_catches_exception_from_logstash_and_logs_erros()
 {
     $object = new \stdClass();
     $this->logstash->write($object)->willThrow(CannotWriteToLogstash::class);
     $this->middleware->handle($object, $this->dummyCallable());
     $this->logger->error(Argument::cetera())->shouldBeCalled();
 }
Exemplo n.º 2
0
 /**
  *
  */
 public function testWrites()
 {
     $this->formatter->format(Argument::any())->shouldBeCalledTimes(1);
     $this->writer->write(Argument::any(), Argument::any())->shouldBeCalledTimes(1);
     $this->dumper->setEnabled(true);
     $this->dumper->dump('id', ['test' => 1]);
 }
Exemplo n.º 3
0
 public function testPutNew()
 {
     $path = 'path.txt';
     $contents = 'contents';
     $this->prophecy->has($path)->willReturn(false);
     $this->prophecy->write($path, $contents, $this->config)->willReturn(compact('path', 'contents'));
     $this->assertTrue($this->filesystem->put($path, $contents));
 }
Exemplo n.º 4
0
 /**
  * @dataProvider runLiveDataProvider
  */
 public function testRunLive($output_type, $expected_output)
 {
     $this->_process->getCommandLine()->willReturn('svn log')->shouldBeCalled();
     $this->_process->mustRun(Argument::type('callable'))->will(function (array $args) use($output_type) {
         return call_user_func($args[0], $output_type, 'TEXT');
     })->shouldBeCalled();
     $this->_process->getOutput()->willReturn('OK')->shouldBeCalled();
     $this->_io->isVerbose()->willReturn(false)->shouldBeCalled();
     $this->_io->isDebug()->willReturn(false)->shouldBeCalled();
     $this->_io->write($expected_output)->shouldBeCalled();
     $this->_cacheManager->getCache(Argument::any())->shouldNotBeCalled();
     $actual_result = $this->_command->runLive(array('TE' => 'KE'));
     $this->assertEquals('OK', $actual_result);
 }
Exemplo n.º 5
0
 public function testWrite()
 {
     $this->output->write('text', true, OutputInterface::OUTPUT_NORMAL)->shouldBeCalled();
     $this->io->write('text', true, OutputInterface::OUTPUT_NORMAL);
 }