We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
1 | <?php |
||
2 | |||
3 | namespace Backpack\CRUD\Tests\Unit\CrudPanel; |
||
4 | |||
5 | use Backpack\CRUD\Tests\config\CrudPanel\BaseCrudPanel; |
||
6 | use Backpack\CRUD\ViewNamespaces; |
||
7 | use Config; |
||
8 | |||
9 | /** |
||
10 | * @covers Backpack\CRUD\ViewNamespaces |
||
11 | * |
||
12 | * There is already one registered view namespace `backpack.theme-coreuiv2::` in the `TestsServiceProvider` class. |
||
13 | */ |
||
14 | class ViewNamespacesTest extends BaseCrudPanel |
||
15 | { |
||
16 | public function testAddSingleViewNamespace() |
||
17 | { |
||
18 | ViewNamespaces::addFor('fields', 'crud::fields'); |
||
19 | ViewNamespaces::addFor('fields', 'pro::fields'); |
||
20 | $this->assertCount(3, ViewNamespaces::getFor('fields')); |
||
21 | } |
||
22 | |||
23 | public function testAddMultipleViewNamespace() |
||
24 | { |
||
25 | ViewNamespaces::addFor('fields', ['crud::fields', 'pro::fields']); |
||
26 | $this->assertCount(3, ViewNamespaces::getFor('fields')); |
||
27 | } |
||
28 | |||
29 | public function testGetWithFallbackFromConfigViewNamespace() |
||
30 | { |
||
31 | Config::set('backpack.crud.fallback_namespace', ['fields' => ['fallback::fields']]); |
||
32 | Config::set('backpack.crud.view_namespaces', ['fields' => ['config::fields']]); |
||
33 | ViewNamespaces::addFor('fields', ['crud::fields', 'pro::fields']); |
||
34 | $this->assertCount(5, ViewNamespaces::getWithFallbackFor('fields', 'backpack.crud.fallback_namespace.fields')); |
||
35 | } |
||
36 | |||
37 | public function testItCanGetTheViewPathsForGivenElement() |
||
38 | { |
||
39 | ViewNamespaces::addFor('fields', ['crud::fields', 'pro::fields']); |
||
40 | $viewPaths = ViewNamespaces::getViewPathsFor('fields', 'test'); |
||
41 | $this->assertCount(3, $viewPaths); |
||
42 | $this->assertEquals(['crud::fields.test', 'backpack.theme-coreuiv2::fields.test', 'pro::fields.test'], array_values($viewPaths)); |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
43 | } |
||
44 | } |
||
45 |