summaryrefslogtreecommitdiff
path: root/vendor/ruflin/elastica/test/lib/Elastica/Test/LogTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/ruflin/elastica/test/lib/Elastica/Test/LogTest.php')
-rw-r--r--vendor/ruflin/elastica/test/lib/Elastica/Test/LogTest.php61
1 files changed, 52 insertions, 9 deletions
diff --git a/vendor/ruflin/elastica/test/lib/Elastica/Test/LogTest.php b/vendor/ruflin/elastica/test/lib/Elastica/Test/LogTest.php
index 188be933..fdfc5c00 100644
--- a/vendor/ruflin/elastica/test/lib/Elastica/Test/LogTest.php
+++ b/vendor/ruflin/elastica/test/lib/Elastica/Test/LogTest.php
@@ -1,8 +1,6 @@
<?php
-
namespace Elastica\Test;
-use Elastica\Client;
use Elastica\Log;
use Elastica\Test\Base as BaseTest;
use Psr\Log\LogLevel;
@@ -12,45 +10,63 @@ class LogTest extends BaseTest
private $_context = array();
private $_message = 'hello world';
- protected function setUp()
+ public static function setUpBeforeClass()
{
if (!class_exists('Psr\Log\AbstractLogger')) {
- $this->markTestSkipped('The Psr extension is not available.');
+ self::markTestSkipped('The Psr extension is not available.');
}
}
+ /**
+ * @group unit
+ */
public function testLogInterface()
{
$log = new Log();
$this->assertInstanceOf('Psr\Log\LoggerInterface', $log);
}
+ /**
+ * @group unit
+ */
public function testSetLogConfigPath()
{
$logPath = '/tmp/php.log';
- $client = new Client(array('log' => $logPath));
+ $client = $this->_getClient(array('log' => $logPath));
$this->assertEquals($logPath, $client->getConfig('log'));
}
+ /**
+ * @group unit
+ */
public function testSetLogConfigEnable()
{
- $client = new Client(array('log' => true));
+ $client = $this->_getClient(array('log' => true));
$this->assertTrue($client->getConfig('log'));
}
+ /**
+ * @group unit
+ */
public function testSetLogConfigEnable1()
{
- $client = new Client();
+ $client = $this->_getClient();
$client->setLogger(new Log());
$this->assertFalse($client->getConfig('log'));
}
+ /**
+ * @group unit
+ */
public function testEmptyLogConfig()
{
$client = $this->_getClient();
$this->assertEmpty($client->getConfig('log'));
}
+ /**
+ * @group unit
+ */
public function testGetLastMessage()
{
$log = new Log('/tmp/php.log');
@@ -63,14 +79,17 @@ class LogTest extends BaseTest
$this->assertEquals($message, $log->getLastMessage());
}
+ /**
+ * @group unit
+ */
public function testGetLastMessage2()
{
- $client = new Client(array('log' => true));
+ $client = $this->_getClient(array('log' => true));
$log = new Log($client);
// Set log path temp path as otherwise test fails with output
$errorLog = ini_get('error_log');
- ini_set('error_log', sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'php.log');
+ ini_set('error_log', sys_get_temp_dir().DIRECTORY_SEPARATOR.'php.log');
$this->_context['error_message'] = $this->_message;
$message = json_encode($this->_context);
@@ -81,6 +100,9 @@ class LogTest extends BaseTest
$this->assertEquals($message, $log->getLastMessage());
}
+ /**
+ * @group unit
+ */
public function testGetLastMessageInfo()
{
$log = $this->initLog();
@@ -88,6 +110,9 @@ class LogTest extends BaseTest
$this->assertEquals($this->getMessage(), $log->getLastMessage());
}
+ /**
+ * @group unit
+ */
public function testGetLastMessageCritical()
{
$log = $this->initLog();
@@ -95,6 +120,9 @@ class LogTest extends BaseTest
$this->assertEquals($this->getMessage(), $log->getLastMessage());
}
+ /**
+ * @group unit
+ */
public function testGetLastMessageAlert()
{
$log = $this->initLog();
@@ -102,6 +130,9 @@ class LogTest extends BaseTest
$this->assertEquals($this->getMessage(), $log->getLastMessage());
}
+ /**
+ * @group unit
+ */
public function testGetLastMessageDebug()
{
$log = $this->initLog();
@@ -109,6 +140,9 @@ class LogTest extends BaseTest
$this->assertEquals($this->getMessage(), $log->getLastMessage());
}
+ /**
+ * @group unit
+ */
public function testGetLastMessageEmergency()
{
$log = $this->initLog();
@@ -116,6 +150,9 @@ class LogTest extends BaseTest
$this->assertEquals($this->getMessage(), $log->getLastMessage());
}
+ /**
+ * @group unit
+ */
public function testGetLastMessageError()
{
$log = $this->initLog();
@@ -123,6 +160,9 @@ class LogTest extends BaseTest
$this->assertEquals($this->getMessage(), $log->getLastMessage());
}
+ /**
+ * @group unit
+ */
public function testGetLastMessageNotice()
{
$log = $this->initLog();
@@ -130,6 +170,9 @@ class LogTest extends BaseTest
$this->assertEquals($this->getMessage(), $log->getLastMessage());
}
+ /**
+ * @group unit
+ */
public function testGetLastMessageWarning()
{
$log = $this->initLog();