diff --git a/tests/Monolog/Formatter/GelfMessageFormatterTest.php b/tests/Monolog/Formatter/GelfMessageFormatterTest.php index 94092689..f82113cb 100644 --- a/tests/Monolog/Formatter/GelfMessageFormatterTest.php +++ b/tests/Monolog/Formatter/GelfMessageFormatterTest.php @@ -12,9 +12,17 @@ namespace Monolog\Formatter; use Monolog\Logger; +use Monolog\Formatter\GelfMessageFormatter; class GelfMessageFormatterTest extends \PHPUnit_Framework_TestCase { + public function setUp() + { + if (!class_exists("Gelf\Message")) { + $this->markTestSkipped("mlehner/gelf-php not installed"); + } + } + /** * @covers Monolog\Formatter\GelfMessageFormatter::format */ diff --git a/tests/Monolog/Handler/GelfHandlerTest.php b/tests/Monolog/Handler/GelfHandlerTest.php index 8b395908..9d54f2a0 100644 --- a/tests/Monolog/Handler/GelfHandlerTest.php +++ b/tests/Monolog/Handler/GelfHandlerTest.php @@ -14,25 +14,16 @@ namespace Monolog\Handler; use Monolog\TestCase; use Monolog\Logger; use Monolog\Formatter\GelfMessageFormatter; -use Gelf\MessagePublisher; -use Gelf\Message; - -class MockMessagePublisher extends MessagePublisher -{ - public function publish(Message $message) { - $this->lastMessage = $message; - } - - public $lastMessage = null; -} class GelfHandlerTest extends TestCase { public function setUp() { - if (!class_exists("Gelf\MessagePublisher")) { + if (!class_exists("Gelf\MessagePublisher") || !class_exists("Gelf\Message")) { $this->markTestSkipped("mlehner/gelf-php not installed"); } + + require_once __DIR__ . '/GelfMocks.php'; } /** diff --git a/tests/Monolog/Handler/GelfMocks.php b/tests/Monolog/Handler/GelfMocks.php new file mode 100644 index 00000000..584c5540 --- /dev/null +++ b/tests/Monolog/Handler/GelfMocks.php @@ -0,0 +1,26 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Gelf\MessagePublisher; +use Gelf\Message; + +class MockMessagePublisher extends MessagePublisher +{ + public function publish(Message $message) { + $this->lastMessage = $message; + } + + public $lastMessage = null; +} + +