Passed
Branch feature/tests (366918)
by Michał
05:45
created

createsThemselvesAndProvideBrowserNameVersionAndPlatform()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 3
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Dziki\MonologSentryBundle\Tests\Unit\UserAgent;
6
7
use Dziki\MonologSentryBundle\UserAgent\UserAgent;
8
use PHPUnit\Framework\TestCase;
0 ignored issues
show
Bug introduced by
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...
9
10
class UserAgentTest extends TestCase
11
{
12
    /**
13
     * @test
14
     * @dataProvider parsedUserAgentDataProvider
15
     *
16
     * @param string $browser
17
     * @param string $version
18
     * @param string $platform
19
     *
20
     */
21
    public function createsThemselvesAndProvideBrowserNameVersionAndPlatform(string $browser, string $version, string $platform): void
22
    {
23
        $userAgent = UserAgent::create($browser, $version, $platform);
24
25
        $this->assertSame($platform, $userAgent->getPlatform());
26
        $this->assertSame($version, $userAgent->getBrowserVersion());
27
        $this->assertSame($browser, $userAgent->getBrowseName());
28
    }
29
30
    public function parsedUserAgentDataProvider(): array
31
    {
32
        return [
33
            ['mozilla', '0.1', 'Mac OS'],
34
            ['', '', ''],
35
            ['not a browser', 'magic one', 'raspberry'],
36
        ];
37
    }
38
}