Passed
Push — 1.x ( e3781f...255b78 )
by Kevin
02:10
created

BrowserKitBrowserTests::can_assert_json_matches()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 9
nc 1
nop 0
dl 0
loc 13
rs 9.9666
c 0
b 0
f 0
1
<?php
2
3
namespace Zenstruck\Browser\Tests;
4
5
use Zenstruck\Browser\Tests\Component\EmailTests;
6
use Zenstruck\Browser\Tests\Extension\HttpTests;
7
use Zenstruck\Browser\Tests\Extension\JsonTests;
8
9
/**
10
 * @author Kevin Bond <[email protected]>
11
 */
12
trait BrowserKitBrowserTests
13
{
14
    use BrowserTests, EmailTests, HttpTests, JsonTests, ProfileAwareTests;
15
16
    /**
17
     * @test
18
     */
19
    public function can_intercept_redirects(): void
20
    {
21
        $this->browser()
0 ignored issues
show
Bug introduced by
The method browser() does not exist on Zenstruck\Browser\Tests\BrowserKitBrowserTests. Did you maybe mean browserClass()? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

21
        $this->/** @scrutinizer ignore-call */ 
22
               browser()

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
22
            ->interceptRedirects()
23
            ->visit('/redirect1')
24
            ->assertOn('/redirect1')
25
            ->assertRedirected()
26
            ->followRedirect()
27
            ->assertOn('/redirect2')
28
            ->assertRedirected()
29
            ->followRedirect()
30
            ->assertOn('/redirect3')
31
            ->assertRedirected()
32
            ->followRedirect()
33
            ->assertOn('/page1')
34
            ->assertSuccessful()
35
        ;
36
    }
37
38
    /**
39
     * @test
40
     */
41
    public function can_assert_redirected_to(): void
42
    {
43
        $this->browser()
44
            ->interceptRedirects()
45
            ->visit('/redirect3')
46
            ->assertRedirectedTo('/page1')
47
        ;
48
    }
49
}
50