-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
/
DeprecationNoticeTest.php
35 lines (28 loc) · 1.21 KB
/
DeprecationNoticeTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
namespace Symfony\Bridge\PhpUnit\Tests\DeprecationErrorHandler;
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\DeprecationErrorHandler\DeprecationNotice;
final class DeprecationNoticeTest extends TestCase
{
public function testItGroupsByCaller()
{
$notice = new DeprecationNotice();
$notice->addObjectOccurrence('MyAction', '__invoke');
$notice->addObjectOccurrence('MyAction', '__invoke');
$notice->addObjectOccurrence('MyOtherAction', '__invoke');
$countsByCaller = $notice->getCountsByCaller();
$this->assertCount(2, $countsByCaller);
$this->assertArrayHasKey('MyAction::__invoke', $countsByCaller);
$this->assertArrayHasKey('MyOtherAction::__invoke', $countsByCaller);
$this->assertSame(2, $countsByCaller['MyAction::__invoke']);
$this->assertSame(1, $countsByCaller['MyOtherAction::__invoke']);
}
public function testItCountsBothTypesOfOccurrences()
{
$notice = new DeprecationNotice();
$notice->addObjectOccurrence('MyAction', '__invoke');
$this->assertSame(1, $notice->count());
$notice->addProceduralOccurrence();
$this->assertSame(2, $notice->count());
}
}