summaryrefslogtreecommitdiff
path: root/vendor/guzzle/guzzle/tests/Guzzle/Tests/Log/ClosureLogAdapterTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/guzzle/guzzle/tests/Guzzle/Tests/Log/ClosureLogAdapterTest.php')
-rw-r--r--vendor/guzzle/guzzle/tests/Guzzle/Tests/Log/ClosureLogAdapterTest.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/vendor/guzzle/guzzle/tests/Guzzle/Tests/Log/ClosureLogAdapterTest.php b/vendor/guzzle/guzzle/tests/Guzzle/Tests/Log/ClosureLogAdapterTest.php
new file mode 100644
index 0000000..0177dc0
--- /dev/null
+++ b/vendor/guzzle/guzzle/tests/Guzzle/Tests/Log/ClosureLogAdapterTest.php
@@ -0,0 +1,30 @@
+<?php
+
+namespace Guzzle\Tests\Log;
+
+use Guzzle\Log\ClosureLogAdapter;
+
+/**
+ * @covers Guzzle\Log\ClosureLogAdapter
+ */
+class ClosureLogAdapterTest extends \Guzzle\Tests\GuzzleTestCase
+{
+ public function testClosure()
+ {
+ $that = $this;
+ $modified = null;
+ $this->adapter = new ClosureLogAdapter(function($message, $priority, $extras = null) use ($that, &$modified) {
+ $modified = array($message, $priority, $extras);
+ });
+ $this->adapter->log('test', LOG_NOTICE, '127.0.0.1');
+ $this->assertEquals(array('test', LOG_NOTICE, '127.0.0.1'), $modified);
+ }
+
+ /**
+ * @expectedException InvalidArgumentException
+ */
+ public function testThrowsExceptionWhenNotCallable()
+ {
+ $this->adapter = new ClosureLogAdapter(123);
+ }
+}