This repository was archived by the owner on Jan 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathXrayTest.php
More file actions
83 lines (62 loc) · 1.71 KB
/
XrayTest.php
File metadata and controls
83 lines (62 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
namespace BeyondCode\ViewXray\Tests;
use Route;
use Spatie\Snapshots\MatchesSnapshots;
use BeyondCode\ViewXray\Events\InjectedXrayBar;
use Illuminate\Support\Facades\Event;
class XrayTest extends TestCase
{
use MatchesSnapshots;
/** @test */
public function it_adds_xray_comments_to_the_output()
{
Route::get('/', function() {
return view('example');
});
$response = $this->get('/');
$this->assertMatchesSnapshot($response->getContent());
}
/** @test */
public function it_does_not_apply_middleware_on_json_responses()
{
$data = [
'foo' => 'bar'
];
Route::get('/', function() use ($data) {
return $data;
});
$this->get('/')->assertJson($data);
}
/** @test */
public function it_adds_xray_when_using_parenthesis_on_sections()
{
Route::get('/', function() {
return view('example2');
});
$response = $this->get('/');
$this->assertMatchesSnapshot($response->getContent());
}
/** @test */
public function it_fires_an_event_if_injected_xray_bar()
{
Event::fake();
Route::get('/', function () {
return view('example');
});
$this->get('/');
Event::assertDispatched(InjectedXrayBar::class);
}
/** @test */
public function it_does_not_fire_an_event_if_injected_xray_bar()
{
Event::fake();
$data = [
'foo' => 'bar'
];
Route::get('/', function () use ($data) {
return $data;
});
$this->get('/');
Event::assertNotDispatched(InjectedXrayBar::class);
}
}