scratch – Blame information for rev 115
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
115 | office | 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 | |||
14 | use Monolog\TestCase; |
||
15 | |||
16 | /** |
||
17 | * @covers Monolog\Handler\SamplingHandler::handle |
||
18 | */ |
||
19 | class SamplingHandlerTest extends TestCase |
||
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 | } |