-
-
Notifications
You must be signed in to change notification settings - Fork 20
/
MultipleCollectionsTest.php
53 lines (44 loc) · 1.61 KB
/
MultipleCollectionsTest.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 Spatie\Sheets\Tests\Integration;
use Illuminate\Support\Collection;
use Spatie\Sheets\PathParsers\SlugWithDateParser;
use Spatie\Sheets\Sheets;
use Spatie\Sheets\Tests\Integration\DummySheets\Page;
use Spatie\Sheets\Tests\Integration\DummySheets\Post;
class MultipleCollectionsTest extends TestCase
{
/** @test */
public function it_can_maintain_multiple_collections()
{
$content = $this->app->make(Sheets::class)->collection('content')->all();
$this->assertInstanceOf(Collection::class, $content);
$this->assertCount(2, $content);
$this->assertContainsOnlyInstancesOf(Page::class, $content);
$posts = $this->app->make(Sheets::class)->collection('posts')->all();
$this->assertInstanceOf(Collection::class, $posts);
$this->assertCount(1, $posts);
$this->assertContainsOnlyInstancesOf(Post::class, $posts);
}
protected function getEnvironmentSetUp($app)
{
$app['config']->set('filesystems.disks.content', [
'driver' => 'local',
'root' => __DIR__.'/../fixtures/content',
]);
$app['config']->set('filesystems.disks.posts', [
'driver' => 'local',
'root' => __DIR__.'/../fixtures/posts',
]);
$app['config']->set('sheets', [
'collections' => [
'content' => [
'sheet_class' => Page::class,
],
'posts' => [
'path_parser' => SlugWithDateParser::class,
'sheet_class' => Post::class,
],
],
]);
}
}