ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
SamplingHandlerTest.php
Go to the documentation of this file.
1<?php
2
3/*
4 * This file is part of the Monolog package.
5 *
6 * (c) Jordi Boggiano <j.boggiano@seld.be>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Monolog\Handler;
13
15
20{
21 public function testHandle()
22 {
23 $testHandler = new TestHandler();
24 $handler = new SamplingHandler($testHandler, 2);
25 for ($i = 0; $i < 10000; $i++) {
26 $handler->handle($this->getRecord());
27 }
28 $count = count($testHandler->getRecords());
29 // $count should be half of 10k, so between 4k and 6k
30 $this->assertLessThan(6000, $count);
31 $this->assertGreaterThan(4000, $count);
32 }
33}
@covers Monolog\Handler\SamplingHandler::handle
Used for testing purposes.
Definition: TestHandler.php:69
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19