-
Notifications
You must be signed in to change notification settings - Fork 186
/
ErrorPageViewModelTest.php
46 lines (32 loc) · 1.26 KB
/
ErrorPageViewModelTest.php
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
<?php
namespace Facade\Ignition\Tests;
use Facade\FlareClient\Report;
use Facade\Ignition\IgnitionConfig;
use Facade\Ignition\ErrorPage\ErrorPageViewModel;
class ErrorPageViewModelTest extends TestCase
{
/** @test */
public function it_can_encode_invalid_user_data()
{
$flareClient = $this->app->make('flare.client');
$exception = new \Exception('Test Exception');
/** @var Report $report */
$report = $flareClient->createReport($exception);
$report->group('bad-utf8', [
'name' => 'Marcel'.utf8_decode('ø'),
]);
$model = new ErrorPageViewModel($exception, new IgnitionConfig([]), $report, []);
$this->assertNotEmpty($model->jsonEncode($report->toArray()));
}
/** @test */
public function it_disables_share_report_when_share_report_controller_action_is_not_defined()
{
$flareClient = $this->app->make('flare.client');
$exception = new \Exception('Test Exception');
/** @var Report $report */
$report = $flareClient->createReport($exception);
$model = new ErrorPageViewModel($exception, new IgnitionConfig([]), $report, []);
$result = $model->toArray();
$this->assertEquals('', $result['shareEndpoint']);
}
}