/** * {@inheritdoc} */ public function register() { $this->app->config->package('rcrowe/raven', realpath(__DIR__ . '/../../config'), 'raven'); $this->app->bindIf('log.raven.dsn', function () { return $this->app->config->get('services.raven.dsn') ?: $this->app->config->get('raven::dsn'); }); $this->app->bindIf('log.raven.transport', function () { return new Transport(); }); $this->app->bindIf('log.raven.handler', function () { return new Handler($this->app['log.raven.transport'], $this->app->queue); }); $this->app->bindIf('log.raven.processors', function () { return $this->app->config->get('raven::monolog.processors', []); }); $this->app->singleton('log.raven', function () { $client = new Client($this->app['log.raven.dsn']); $client->tags_context(['laravel_environment' => $this->app->environment(), 'laravel_version' => Application::VERSION]); $client->setHandler($this->app['log.raven.handler']); return $client; }); }
public function testProcessParams() { $client = new Client('https://*****:*****@app.getsentry.com/789'); $data = array('foo' => 'bar'); $message = Raven_Compat::json_encode($data); if (function_exists("gzcompress")) { $message = base64_encode(gzcompress($message)); } $handler = m::mock('rcrowe\\Raven\\Handler\\HandlerInterface'); $handler->shouldReceive('process')->once()->with('https://app.getsentry.com/api/store/', $message, m::on(function ($param) { if (!array_key_exists('User-Agent', $param)) { return false; } if ($param['User-Agent'] !== 'rcrowe-raven/' . Client::VERSION) { return false; } if (!array_key_exists('X-Sentry-Auth', $param)) { return false; } if (!array_key_exists('Content-Type', $param)) { return false; } if ($param['Content-Type'] !== 'application/octet-stream') { return false; } return true; })); $client->setHandler($handler); $client->send($data); }