| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- <?php declare(strict_types=1);
- /*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <j.boggiano@seld.be>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
- namespace Monolog\Handler;
- use Monolog\Test\TestCase;
- /**
- * @author Alexey Karapetov <alexey@karapetov.com>
- */
- class HandlerWrapperTest extends TestCase
- {
- /**
- * @var HandlerWrapper
- */
- private $wrapper;
- private $handler;
- public function setUp()
- {
- parent::setUp();
- $this->handler = $this->createMock('Monolog\\Handler\\HandlerInterface');
- $this->wrapper = new HandlerWrapper($this->handler);
- }
- /**
- * @return array
- */
- public function trueFalseDataProvider()
- {
- return [
- [true],
- [false],
- ];
- }
- /**
- * @param $result
- * @dataProvider trueFalseDataProvider
- */
- public function testIsHandling($result)
- {
- $record = $this->getRecord();
- $this->handler->expects($this->once())
- ->method('isHandling')
- ->with($record)
- ->willReturn($result);
- $this->assertEquals($result, $this->wrapper->isHandling($record));
- }
- /**
- * @param $result
- * @dataProvider trueFalseDataProvider
- */
- public function testHandle($result)
- {
- $record = $this->getRecord();
- $this->handler->expects($this->once())
- ->method('handle')
- ->with($record)
- ->willReturn($result);
- $this->assertEquals($result, $this->wrapper->handle($record));
- }
- /**
- * @param $result
- * @dataProvider trueFalseDataProvider
- */
- public function testHandleBatch($result)
- {
- $records = $this->getMultipleRecords();
- $this->handler->expects($this->once())
- ->method('handleBatch')
- ->with($records);
- $this->wrapper->handleBatch($records);
- }
- }
|