forked from facade/ignition
/
MakeViewVariableOptionalSolutionTest.php
53 lines (44 loc) · 1.53 KB
/
MakeViewVariableOptionalSolutionTest.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
47
48
49
50
51
52
53
<?php
namespace Facade\Ignition\Tests\Solutions;
use Facade\Ignition\Exceptions\ViewException;
use Facade\Ignition\Solutions\MakeViewVariableOptionalSolution;
use Facade\Ignition\Support\ComposerClassMap;
use Facade\Ignition\Tests\TestCase;
use Illuminate\Support\Facades\View;
use Illuminate\Support\Str;
class MakeViewVariableOptionalSolutionTest extends TestCase
{
public function setUp(): void
{
parent::setUp();
View::addLocation(__DIR__.'/../stubs/views');
$this->app->bind(
ComposerClassMap::class,
function () {
return new ComposerClassMap(__DIR__.'/../../vendor/autoload.php');
}
);
}
/** @test */
public function it_does_not_open_scheme_paths()
{
$solution = $this->getSolutionForPath('php://filter/resource=./tests/stubs/views/blade-exception.blade.php');
$this->assertFalse($solution->isRunnable());
}
/** @test */
public function it_does_open_relative_paths()
{
$solution = $this->getSolutionForPath('./tests/stubs/views/blade-exception.blade.php');
$this->assertTrue($solution->isRunnable());
}
/** @test */
public function it_does_not_open_other_extentions()
{
$solution = $this->getSolutionForPath('./tests/stubs/views/php-exception.php');
$this->assertFalse($solution->isRunnable());
}
protected function getSolutionForPath($path): MakeViewVariableOptionalSolution
{
return new MakeViewVariableOptionalSolution('notSet', $path);
}
}