Passed
Pull Request — 1.x (#23)
by Wouter
01:49
created

HasBrowser   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
eloc 7
c 3
b 0
f 0
dl 0
loc 12
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A browser() 0 3 1
1
<?php
2
3
namespace Zenstruck\Browser\Test;
4
5
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
6
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
7
use Symfony\Component\BrowserKit\HttpBrowser as HttpBrowserClient;
8
use Symfony\Component\Panther\Client as PantherClient;
9
use Symfony\Component\Panther\PantherTestCase;
10
use Zenstruck\Browser\HttpBrowser;
11
use Zenstruck\Browser\KernelBrowser;
12
use Zenstruck\Browser\PantherBrowser;
13
14
/**
15
 * @author Kevin Bond <[email protected]>
16
 */
17
trait HasBrowser
18
{
19
    use HasKernelBrowser, HasHttpBrowser, HasPantherBrowser {
20
        HasKernelBrowser::browser insteadof HasHttpBrowser;
21
        HasKernelBrowser::browser as kernelBrowser;
22
        HasHttpBrowser::browser as httpBrowser;
23
        HasPantherBrowser::browser as pantherBrowser;
24
    }
25
26
    protected function browser(): void
27
    {
28
        throw new \BadMethodCallException(sprintf('"%s" cannot be used when using the "HasBrowser" trait, use any of "kernelBrowser()", "httpBrowser()" or "pantherBrowser()" instead.', __METHOD__));
29
    }
30
}
31