Issues (32)

ControllerNamingStrategyTest.php (1 issue)

1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of Ekino New Relic bundle.
7
 *
8
 * (c) Ekino - Thomas Rabaix <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Ekino\NewRelicBundle\TransactionNamingStrategy;
15
16
use PHPUnit\Framework\TestCase;
0 ignored issues
show
The type PHPUnit\Framework\TestCase was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
17
use Symfony\Component\HttpFoundation\Request;
18
19
class ControllerNamingStrategyTest extends TestCase
20
{
21
    public function testControllerAsString()
22
    {
23
        $request = new Request();
24
        $request->attributes->set('_controller', 'SomeBundle:Some:SomeAction');
25
26
        $strategy = new ControllerNamingStrategy();
27
        $this->assertSame('SomeBundle:Some:SomeAction', $strategy->getTransactionName($request));
28
    }
29
30
    public function testControllerAsClosure()
31
    {
32
        $request = new Request();
33
        $request->attributes->set('_controller', function () {
34
        });
35
36
        $strategy = new ControllerNamingStrategy();
37
        $this->assertSame('Closure controller', $strategy->getTransactionName($request));
38
    }
39
40
    public function testControllerAsCallback()
41
    {
42
        $request = new Request();
43
        $request->attributes->set('_controller', [$this, 'testControllerAsString']);
44
45
        $strategy = new ControllerNamingStrategy();
46
        $this->assertSame('Callback controller: Ekino\NewRelicBundle\TransactionNamingStrategy\ControllerNamingStrategyTest::testControllerAsString()', $strategy->getTransactionName($request));
47
    }
48
49
    public function testControllerUnknown()
50
    {
51
        $request = new Request();
52
53
        $strategy = new ControllerNamingStrategy();
54
        $this->assertSame('Unknown Symfony controller', $strategy->getTransactionName($request));
55
    }
56
}
57