#!/usr/bin/env php getMessage()); } $client = new Raven_Client($dsn, array( 'trace' => true, 'curl_method' => 'sync', 'app_path' => realpath(__DIR__ . '/..'), 'base_path' => realpath(__DIR__ . '/..'), )); $config = get_object_vars($client); $required_keys = array('server', 'project', 'public_key'); echo "Client configuration:\n"; foreach ($required_keys as $key) { if (empty($config[$key])) { exit("ERROR: Missing configuration for $key"); } if (is_array($config[$key])) { echo "-> $key: [".implode(", ", $config[$key])."]\n"; } else { echo "-> $key: $config[$key]\n"; } } echo "\n"; echo "Sending a test event:\n"; $ex = raven_cli_test("command name", array("foo" => "bar")); $event_id = $client->captureException($ex); echo "-> event ID: $event_id\n"; $last_error = $client->getLastError(); if (!empty($last_error)) { exit("ERROR: There was an error sending the test event:\n " . $last_error); } echo "\n"; echo "Done!"; } function main() { global $argv; if (!isset($argv[1])) { exit('Usage: sentry test '); } $cmd = $argv[1]; switch ($cmd) { case 'test': cmd_test(@$argv[2]); break; default: exit('Usage: sentry test '); } } main();