UserAgentTest::parsedUserAgentDataProvider()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 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;
9
10
/**
11
 * @covers \Dziki\MonologSentryBundle\UserAgent\UserAgent
12
 */
13
class UserAgentTest extends TestCase
14
{
15
    /**
16
     * @test
17
     * @dataProvider parsedUserAgentDataProvider
18
     *
19
     * @param string $browser
20
     * @param string $version
21
     * @param string $platform
22
     */
23
    public function createsThemselvesAndProvideBrowserNameVersionAndPlatform(string $browser, string $version, string $platform): void
24
    {
25
        $userAgent = UserAgent::create($browser, $version, $platform);
26
27
        $this->assertSame($platform, $userAgent->getPlatform());
28
        $this->assertSame($version, $userAgent->getBrowserVersion());
29
        $this->assertSame($browser, $userAgent->getBrowseName());
30
    }
31
32
    public function parsedUserAgentDataProvider(): array
33
    {
34
        return [
35
            ['mozilla', '0.1', 'Mac OS'],
36
            ['', '', ''],
37
            ['not a browser', 'magic one', 'raspberry'],
38
        ];
39
    }
40
}
41