Skip to content

Commit b1081db

Browse files
committed
add unit test for Blade directive config
1 parent df0adad commit b1081db

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

tests/SharedDataTest.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Coderello\SharedData\Tests;
44

5+
use Coderello\SharedData\Providers\SharedDataServiceProvider;
56
use Coderello\SharedData\SharedData;
67
use Illuminate\Contracts\Support\Arrayable;
78
use JsonSerializable;
@@ -293,11 +294,26 @@ public function testForget()
293294
$this->assertSame([], $this->sharedData->get());
294295
}
295296

296-
public function testDirective()
297+
public function testBladeDirective()
297298
{
298299
$this->assertEquals(
299300
shared()->render(),
300301
view('shared')->render()
301302
);
302303
}
304+
305+
/**
306+
* @depends testBladeDirective
307+
*/
308+
public function testBladeDirectiveCustom()
309+
{
310+
$this->app->make('config')->set('shared-data.blade_directive', 'shared_custom');
311+
312+
$this->app->register(SharedDataServiceProvider::class);
313+
314+
$this->assertEquals(
315+
shared()->render(),
316+
view('shared-custom')->render()
317+
);
318+
}
303319
}

tests/views/shared-custom.blade.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@shared_custom

0 commit comments

Comments
 (0)