mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-10 07:06:40 +02:00
stream handler creates a directory if its possible
This commit is contained in:
@@ -112,7 +112,51 @@ class StreamHandlerTest extends TestCase
|
||||
*/
|
||||
public function testWriteNonExistingResource()
|
||||
{
|
||||
$handler = new StreamHandler('/foo/bar/baz/'.rand(0, 10000));
|
||||
$handler = new StreamHandler('ftp://foo/bar/baz/'.rand(0, 10000));
|
||||
$handler->handle($this->getRecord());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Monolog\Handler\StreamHandler::__construct
|
||||
* @covers Monolog\Handler\StreamHandler::write
|
||||
*/
|
||||
public function testWriteNonExistingPath()
|
||||
{
|
||||
$handler = new StreamHandler(sys_get_temp_dir().'/bar/'.rand(0, 10000).DIRECTORY_SEPARATOR.rand(0, 10000));
|
||||
$handler->handle($this->getRecord());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Monolog\Handler\StreamHandler::__construct
|
||||
* @covers Monolog\Handler\StreamHandler::write
|
||||
*/
|
||||
public function testWriteNonExistingFileResource()
|
||||
{
|
||||
$handler = new StreamHandler('file://'.sys_get_temp_dir().'/bar/'.rand(0, 10000).DIRECTORY_SEPARATOR.rand(0, 10000));
|
||||
$handler->handle($this->getRecord());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessageRegExp /There is no existing directory at/
|
||||
* @covers Monolog\Handler\StreamHandler::__construct
|
||||
* @covers Monolog\Handler\StreamHandler::write
|
||||
*/
|
||||
public function testWriteNonExistingAndNotCreatablePath()
|
||||
{
|
||||
$handler = new StreamHandler('/foo/bar/'.rand(0, 10000).DIRECTORY_SEPARATOR.rand(0, 10000));
|
||||
$handler->handle($this->getRecord());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessageRegExp /There is no existing directory at/
|
||||
* @covers Monolog\Handler\StreamHandler::__construct
|
||||
* @covers Monolog\Handler\StreamHandler::write
|
||||
*/
|
||||
public function testWriteNonExistingAndNotCreatableFileResource()
|
||||
{
|
||||
$handler = new StreamHandler('file:///foo/bar/'.rand(0, 10000).DIRECTORY_SEPARATOR.rand(0, 10000));
|
||||
$handler->handle($this->getRecord());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user