mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-03 19:57:41 +02:00
Remove old SocketTest. Fix CS issues
This commit is contained in:
@@ -15,7 +15,6 @@ use Monolog\Logger;
|
||||
use Monolog\Handler\SocketHandler\Exception\ConnectionException;
|
||||
use Monolog\Handler\SocketHandler\Exception\WriteToSocketException;
|
||||
|
||||
|
||||
/**
|
||||
* Stores to any socket - uses fsockopen() or pfsockopen().
|
||||
*
|
||||
@@ -24,6 +23,7 @@ use Monolog\Handler\SocketHandler\Exception\WriteToSocketException;
|
||||
*/
|
||||
class SocketHandler extends AbstractProcessingHandler
|
||||
{
|
||||
|
||||
private $connectionString;
|
||||
private $connectionTimeout;
|
||||
private $resource;
|
||||
@@ -39,7 +39,7 @@ class SocketHandler extends AbstractProcessingHandler
|
||||
{
|
||||
parent::__construct($level, $bubble);
|
||||
$this->connectionString = $connectionString;
|
||||
$this->connectionTimeout = (float)ini_get('default_socket_timeout');
|
||||
$this->connectionTimeout = (float) ini_get('default_socket_timeout');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -76,7 +76,7 @@ class SocketHandler extends AbstractProcessingHandler
|
||||
|
||||
public function setPersistent($boolean)
|
||||
{
|
||||
$this->persistent = (boolean)$boolean;
|
||||
$this->persistent = (boolean) $boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -88,7 +88,7 @@ class SocketHandler extends AbstractProcessingHandler
|
||||
public function setConnectionTimeout($seconds)
|
||||
{
|
||||
$this->validateTimeout($seconds);
|
||||
$this->connectionTimeout = (float)$seconds;
|
||||
$this->connectionTimeout = (float) $seconds;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -100,7 +100,7 @@ class SocketHandler extends AbstractProcessingHandler
|
||||
public function setTimeout($seconds)
|
||||
{
|
||||
$this->validateTimeout($seconds);
|
||||
$this->timeout = (int)$seconds;
|
||||
$this->timeout = (int) $seconds;
|
||||
}
|
||||
|
||||
private function validateTimeout($value)
|
||||
@@ -123,11 +123,13 @@ class SocketHandler extends AbstractProcessingHandler
|
||||
return $this->persistent;
|
||||
}
|
||||
|
||||
public function getConnectionTimeout() {
|
||||
public function getConnectionTimeout()
|
||||
{
|
||||
return $this->connectionTimeout;
|
||||
}
|
||||
|
||||
public function getTimeout() {
|
||||
public function getTimeout()
|
||||
{
|
||||
return $this->timeout;
|
||||
}
|
||||
|
||||
@@ -228,4 +230,5 @@ class SocketHandler extends AbstractProcessingHandler
|
||||
{
|
||||
return stream_get_meta_data($this->resource);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -13,4 +13,5 @@ namespace Monolog\Handler\SocketHandler\Exception;
|
||||
|
||||
class ConnectionException extends \RuntimeException
|
||||
{
|
||||
|
||||
}
|
@@ -13,4 +13,5 @@ namespace Monolog\Handler\SocketHandler\Exception;
|
||||
|
||||
class WriteToSocketException extends \RuntimeException
|
||||
{
|
||||
|
||||
}
|
@@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Monolog\Handler\SocketHandler;
|
||||
|
||||
class SocketTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
}
|
@@ -21,6 +21,7 @@ use Monolog\Handler\SocketHandler\Exception\WriteToSocketException;
|
||||
*/
|
||||
class SocketHandlerTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @var Monolog\Handler\SocketHandler
|
||||
*/
|
||||
@@ -34,7 +35,8 @@ class SocketHandlerTest extends TestCase
|
||||
/**
|
||||
* @expectedException Monolog\Handler\SocketHandler\Exception\ConnectionException
|
||||
*/
|
||||
public function testInvalidHostname() {
|
||||
public function testInvalidHostname()
|
||||
{
|
||||
$this->createHandler('garbage://here');
|
||||
$this->writeRecord('data');
|
||||
}
|
||||
@@ -85,6 +87,7 @@ class SocketHandlerTest extends TestCase
|
||||
$this->writeRecord($string);
|
||||
$this->fail("Shoul not connect - are you running a server on 127.0.0.1:7894 ?");
|
||||
} catch (\Monolog\Handler\SocketHandler\Exception\ConnectionException $e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -251,10 +254,9 @@ class SocketHandlerTest extends TestCase
|
||||
private function setMockHandler(array $methods)
|
||||
{
|
||||
$this->handler = $this->getMock(
|
||||
'\Monolog\Handler\SocketHandler',
|
||||
$methods,
|
||||
array('localhost:1234')
|
||||
'\Monolog\Handler\SocketHandler', $methods, array('localhost:1234')
|
||||
);
|
||||
$this->handler->setFormatter($this->getIdentityFormatter());
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user