ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 
12 namespace 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 }
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
Used for testing purposes.
Definition: TestHandler.php:66