diff --git a/tests/Foundation/Entries/EntriesTest.php b/tests/Foundation/Entries/EntriesTest.php index bd0dc3b7..e5570b4d 100644 --- a/tests/Foundation/Entries/EntriesTest.php +++ b/tests/Foundation/Entries/EntriesTest.php @@ -9,151 +9,151 @@ afterEach(function (): void { }); test('test create() method', function () { - $this->assertTrue(flextype('entries')->create('foo', [])); - $this->assertFalse(flextype('entries')->create('foo', [])); + $this->assertTrue(flextype('content')->create('foo', [])); + $this->assertFalse(flextype('content')->create('foo', [])); }); test('test has()', function () { - flextype('entries')->create('foo', []); + flextype('content')->create('foo', []); - $this->assertTrue(flextype('entries')->has('foo')); - $this->assertFalse(flextype('entries')->has('bar')); + $this->assertTrue(flextype('content')->has('foo')); + $this->assertFalse(flextype('content')->has('bar')); }); test('test update() method', function () { - flextype('entries')->create('foo', []); + flextype('content')->create('foo', []); - $this->assertTrue(flextype('entries')->update('foo', ['title' => 'Test'])); - $this->assertFalse(flextype('entries')->update('bar', ['title' => 'Test'])); + $this->assertTrue(flextype('content')->update('foo', ['title' => 'Test'])); + $this->assertFalse(flextype('content')->update('bar', ['title' => 'Test'])); }); test('test fetch() entry', function () { - flextype('entries')->create('foo', ['title' => 'Foo']); - flextype('entries')->create('foo/bar', ['title' => 'Bar']); - flextype('entries')->create('foo/baz', ['title' => 'Baz']); - flextype('entries')->create('foo/zed', ['title' => 'Zed']); + flextype('content')->create('foo', ['title' => 'Foo']); + flextype('content')->create('foo/bar', ['title' => 'Bar']); + flextype('content')->create('foo/baz', ['title' => 'Baz']); + flextype('content')->create('foo/zed', ['title' => 'Zed']); - $this->assertEquals(12, flextype('entries')->fetch('foo')->count()); - $this->assertEquals('foo', flextype('entries')->fetch('foo')['id']); - $this->assertEquals(12, flextype('entries')->fetch('foo', [])->count()); - $this->assertEquals('foo', flextype('entries')->fetch('foo')['id']); - $this->assertEquals(3, flextype('entries')->fetch('foo', ['collection' => true])->count()); + $this->assertEquals(12, flextype('content')->fetch('foo')->count()); + $this->assertEquals('foo', flextype('content')->fetch('foo')['id']); + $this->assertEquals(12, flextype('content')->fetch('foo', [])->count()); + $this->assertEquals('foo', flextype('content')->fetch('foo')['id']); + $this->assertEquals(3, flextype('content')->fetch('foo', ['collection' => true])->count()); - $this->assertEquals('Bar', flextype('entries')->fetch('foo/bar')['title']); - $this->assertEquals('Baz', flextype('entries')->fetch('foo/baz')['title']); - $this->assertEquals('Zed', flextype('entries')->fetch('foo/zed')['title']); + $this->assertEquals('Bar', flextype('content')->fetch('foo/bar')['title']); + $this->assertEquals('Baz', flextype('content')->fetch('foo/baz')['title']); + $this->assertEquals('Zed', flextype('content')->fetch('foo/zed')['title']); - flextype('entries')->storage()->set('fetch.id', 'wrong-entry'); - $this->assertEquals(0, flextype('entries')->fetch('wrong-entry')->count()); - flextype('entries')->storage()->set('fetch.id', 'wrong-entry'); - $this->assertEquals(0, flextype('entries')->fetch('wrong-entry')->count()); + flextype('content')->storage()->set('fetch.id', 'wrong-entry'); + $this->assertEquals(0, flextype('content')->fetch('wrong-entry')->count()); + flextype('content')->storage()->set('fetch.id', 'wrong-entry'); + $this->assertEquals(0, flextype('content')->fetch('wrong-entry')->count()); - $this->assertTrue(count(flextype('entries')->fetch('foo', ['collection' => true])) > 0); + $this->assertTrue(count(flextype('content')->fetch('foo', ['collection' => true])) > 0); /* - flextype('emitter')->addListener('onEntriesFetchCollectionHasResult', static function (): void { - flextype('entries')->storage()->set('fetch_collection.data.foo/zed.title', 'ZedFromCollection!'); + flextype('emitter')->addListener('onContentFetchCollectionHasResult', static function (): void { + flextype('content')->storage()->set('fetch_collection.data.foo/zed.title', 'ZedFromCollection!'); }); - flextype('emitter')->addListener('onEntriesFetchCollectionHasResult', static function (): void { - flextype('entries')->storage()->set('fetch_collection.data.foo/baz.title', 'BazFromCollection!'); + flextype('emitter')->addListener('onContentFetchCollectionHasResult', static function (): void { + flextype('content')->storage()->set('fetch_collection.data.foo/baz.title', 'BazFromCollection!'); }); - $this->assertEquals('ZedFromCollection!', flextype('entries')->fetch('foo', ['collection' => true])['foo/zed.title']); - $this->assertEquals('BazFromCollection!', flextype('entries')->fetch('foo', ['collection' => true])['foo/baz.title']); + $this->assertEquals('ZedFromCollection!', flextype('content')->fetch('foo', ['collection' => true])['foo/zed.title']); + $this->assertEquals('BazFromCollection!', flextype('content')->fetch('foo', ['collection' => true])['foo/baz.title']); */ }); test('test copy() method', function () { - flextype('entries')->create('foo', []); - flextype('entries')->create('foo/bar', []); - flextype('entries')->create('foo/baz', []); + flextype('content')->create('foo', []); + flextype('content')->create('foo/bar', []); + flextype('content')->create('foo/baz', []); - flextype('entries')->create('zed', []); - flextype('entries')->copy('foo', 'zed'); + flextype('content')->create('zed', []); + flextype('content')->copy('foo', 'zed'); - $this->assertTrue(flextype('entries')->has('zed')); + $this->assertTrue(flextype('content')->has('zed')); }); test('test delete() method', function () { - flextype('entries')->create('foo', []); - flextype('entries')->create('foo/bar', []); - flextype('entries')->create('foo/baz', []); + flextype('content')->create('foo', []); + flextype('content')->create('foo/bar', []); + flextype('content')->create('foo/baz', []); - $this->assertTrue(flextype('entries')->delete('foo')); - $this->assertFalse(flextype('entries')->has('foo')); + $this->assertTrue(flextype('content')->delete('foo')); + $this->assertFalse(flextype('content')->has('foo')); }); test('test move() method', function () { - flextype('entries')->create('foo', []); - flextype('entries')->create('zed', []); + flextype('content')->create('foo', []); + flextype('content')->create('zed', []); - $this->assertTrue(flextype('entries')->move('foo', 'bar')); - $this->assertTrue(flextype('entries')->has('bar')); - $this->assertFalse(flextype('entries')->has('foo')); - $this->assertFalse(flextype('entries')->move('zed', 'bar')); + $this->assertTrue(flextype('content')->move('foo', 'bar')); + $this->assertTrue(flextype('content')->has('bar')); + $this->assertFalse(flextype('content')->has('foo')); + $this->assertFalse(flextype('content')->move('zed', 'bar')); }); test('test getFileLocation() method', function () { - flextype('entries')->create('foo', []); + flextype('content')->create('foo', []); $this->assertStringContainsString('/foo/entry.md', - flextype('entries')->getFileLocation('foo')); + flextype('content')->getFileLocation('foo')); }); test('test getDirectoryLocation() entry', function () { - flextype('entries')->create('foo', []); + flextype('content')->create('foo', []); $this->assertStringContainsString('/foo', - flextype('entries')->getDirectoryLocation('foo')); + flextype('content')->getDirectoryLocation('foo')); }); test('test getCacheID() entry', function () { flextype('registry')->set('flextype.settings.cache.enabled', false); - flextype('entries')->create('foo', []); - $this->assertEquals('', flextype('entries')->getCacheID('foo')); + flextype('content')->create('foo', []); + $this->assertEquals('', flextype('content')->getCacheID('foo')); flextype('registry')->set('flextype.settings.cache.enabled', true); - flextype('entries')->create('bar', []); - $cache_id = flextype('entries')->getCacheID('bar'); + flextype('content')->create('bar', []); + $cache_id = flextype('content')->getCacheID('bar'); $this->assertEquals(32, strlen($cache_id)); flextype('registry')->set('flextype.settings.cache.enabled', false); }); test('test storage() entry', function () { - flextype('entries')->storage()->set('foo', ['title' => 'Foo']); - $this->assertEquals('Foo', flextype('entries')->storage()->get('foo')['title']); - flextype('entries')->storage()->set('bar', ['title' => 'Bar']); - $this->assertEquals(true, flextype('entries')->storage()->has('foo.title')); - $this->assertEquals(true, flextype('entries')->storage()->has('bar.title')); - flextype('entries')->storage()->delete('foo.title'); - flextype('entries')->storage()->delete('bar.title'); - $this->assertEquals(false, flextype('entries')->storage()->has('foo.title')); - $this->assertEquals(false, flextype('entries')->storage()->has('bar.title')); + flextype('content')->storage()->set('foo', ['title' => 'Foo']); + $this->assertEquals('Foo', flextype('content')->storage()->get('foo')['title']); + flextype('content')->storage()->set('bar', ['title' => 'Bar']); + $this->assertEquals(true, flextype('content')->storage()->has('foo.title')); + $this->assertEquals(true, flextype('content')->storage()->has('bar.title')); + flextype('content')->storage()->delete('foo.title'); + flextype('content')->storage()->delete('bar.title'); + $this->assertEquals(false, flextype('content')->storage()->has('foo.title')); + $this->assertEquals(false, flextype('content')->storage()->has('bar.title')); }); test('test macro() entry', function () { - flextype('entries')->create('foo', []); - flextype('entries')->create('foo/bar', []); - flextype('entries')->create('foo/baz', []); + flextype('content')->create('foo', []); + flextype('content')->create('foo/bar', []); + flextype('content')->create('foo/baz', []); - flextype('entries')::macro('fetchRecentPosts', function($limit = 1) { - return flextype('entries') + flextype('content')::macro('fetchRecentPosts', function($limit = 1) { + return flextype('content') ->fetch('foo') ->sortBy('published_at') ->limit($limit); }); - $this->assertEquals(1, flextype('entries')->fetchRecentPosts()->count()); - $this->assertEquals(1, flextype('entries')->fetchRecentPosts(1)->count()); - $this->assertEquals(2, flextype('entries')->fetchRecentPosts(2)->count()); + $this->assertEquals(1, flextype('content')->fetchRecentPosts()->count()); + $this->assertEquals(1, flextype('content')->fetchRecentPosts(1)->count()); + $this->assertEquals(2, flextype('content')->fetchRecentPosts(2)->count()); }); test('test mixin() entry', function () { - flextype('entries')->create('foo', []); - flextype('entries')->create('foo/bar', []); - flextype('entries')->create('foo/baz', []); + flextype('content')->create('foo', []); + flextype('content')->create('foo/bar', []); + flextype('content')->create('foo/baz', []); class FooMixin { public function foo() { @@ -169,9 +169,9 @@ test('test mixin() entry', function () { } } - flextype('entries')::mixin(new FooMixin()); + flextype('content')::mixin(new FooMixin()); - $this->assertEquals('Foo', flextype('entries')->foo()); - $this->assertEquals('Foo', flextype('entries')->bar()); - $this->assertEquals('Bar', flextype('entries')->bar('Bar')); + $this->assertEquals('Foo', flextype('content')->foo()); + $this->assertEquals('Foo', flextype('content')->bar()); + $this->assertEquals('Bar', flextype('content')->bar('Bar')); }); diff --git a/tests/Foundation/Entries/Fields/CreatedAtFieldTest.php b/tests/Foundation/Entries/Fields/CreatedAtFieldTest.php index b9fc101e..fe7685bd 100644 --- a/tests/Foundation/Entries/Fields/CreatedAtFieldTest.php +++ b/tests/Foundation/Entries/Fields/CreatedAtFieldTest.php @@ -12,8 +12,8 @@ afterEach(function (): void { test('test CreatedAtField', function () { // 1 - flextype('entries')->create('foo', []); - $created_at = flextype('entries')->fetch('foo')['created_at']; + flextype('content')->create('foo', []); + $created_at = flextype('content')->fetch('foo')['created_at']; $this->assertTrue(strlen($created_at) > 0); $this->assertTrue((ctype_digit($created_at) && strtotime(date('Y-m-d H:i:s', $created_at)) === (int)$created_at)); }); diff --git a/tests/Foundation/Entries/Fields/CreatedByFieldTest.php b/tests/Foundation/Entries/Fields/CreatedByFieldTest.php index c97aa8c9..cdcd7e0b 100644 --- a/tests/Foundation/Entries/Fields/CreatedByFieldTest.php +++ b/tests/Foundation/Entries/Fields/CreatedByFieldTest.php @@ -11,11 +11,11 @@ afterEach(function (): void { }); test('test CreatedByField', function () { - flextype('entries')->create('foo', []); - $created_by = flextype('entries')->fetch('foo')['created_by']; + flextype('content')->create('foo', []); + $created_by = flextype('content')->fetch('foo')['created_by']; $this->assertEquals('', $created_by); - flextype('entries')->create('bar', ['created_by' => 'Zed']); - $created_by = flextype('entries')->fetch('bar')['created_by']; + flextype('content')->create('bar', ['created_by' => 'Zed']); + $created_by = flextype('content')->fetch('bar')['created_by']; $this->assertEquals('Zed', $created_by); }); diff --git a/tests/Foundation/Entries/Fields/EntriesFieldTest.php b/tests/Foundation/Entries/Fields/EntriesFieldTest.php index 35bf7e5e..8f96ec13 100644 --- a/tests/Foundation/Entries/Fields/EntriesFieldTest.php +++ b/tests/Foundation/Entries/Fields/EntriesFieldTest.php @@ -11,11 +11,11 @@ afterEach(function (): void { }); test('test entries field for blog', function () { - flextype('entries')->create('blog', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/entries/blog/entry.md')->get())); - flextype('entries')->create('blog/post-1', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/entries/blog/post-1/entry.md')->get())); - flextype('entries')->create('blog/post-2', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/entries/blog/post-2/entry.md')->get())); + flextype('content')->create('blog', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/entries/blog/entry.md')->get())); + flextype('content')->create('blog/post-1', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/entries/blog/post-1/entry.md')->get())); + flextype('content')->create('blog/post-2', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/entries/blog/post-2/entry.md')->get())); - $blog = flextype('entries')->fetch('blog'); + $blog = flextype('content')->fetch('blog'); $this->assertEquals(14, $blog->count()); }); @@ -23,22 +23,22 @@ test('test entries field for blog', function () { test('test entries field for catalog', function () { // Create catalog - flextype('entries')->create('catalog', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/entries/catalog/entry.md')->get())); - flextype('entries')->create('catalog/bikes', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/entries/catalog/bikes/entry.md')->get())); - flextype('entries')->create('catalog/bikes/gt', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/entries/catalog/bikes/gt/entry.md')->get())); - flextype('entries')->create('catalog/bikes/norco', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/entries/catalog/bikes/norco/entry.md')->get())); - flextype('entries')->create('catalog/bikes/foo', ['title' => 'foo']); - flextype('entries')->create('catalog/bikes/foo/bar', ['title' => 'bar']); + flextype('content')->create('catalog', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/entries/catalog/entry.md')->get())); + flextype('content')->create('catalog/bikes', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/entries/catalog/bikes/entry.md')->get())); + flextype('content')->create('catalog/bikes/gt', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/entries/catalog/bikes/gt/entry.md')->get())); + flextype('content')->create('catalog/bikes/norco', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/entries/catalog/bikes/norco/entry.md')->get())); + flextype('content')->create('catalog/bikes/foo', ['title' => 'foo']); + flextype('content')->create('catalog/bikes/foo/bar', ['title' => 'bar']); // Create discounts - flextype('entries')->create('discounts', ['title' => 'Discounts']); - flextype('entries')->create('discounts/30-off', ['title' => '30% off', 'category' => 'bikes']); - flextype('entries')->create('discounts/50-off', ['title' => '50% off', 'category' => 'bikes']); + flextype('content')->create('discounts', ['title' => 'Discounts']); + flextype('content')->create('discounts/30-off', ['title' => '30% off', 'category' => 'bikes']); + flextype('content')->create('discounts/50-off', ['title' => '50% off', 'category' => 'bikes']); // Create banner - flextype('entries')->create('banner', ['title' => 'Banner']); + flextype('content')->create('banner', ['title' => 'Banner']); - $catalogSingle = flextype('entries')->fetch('catalog'); + $catalogSingle = flextype('content')->fetch('catalog'); $this->assertEquals(16, $catalogSingle->count()); $this->assertEquals('Catalog', $catalogSingle['title']); @@ -50,42 +50,42 @@ test('test entries field for catalog', function () { $this->assertTrue(isset($catalogSingle['discounts']['discounts/30-off'])); $this->assertEquals('30% off', $catalogSingle['discounts']['discounts/30-off']['title']); - $catalogCollection = flextype('entries')->fetch('catalog', ['collection' => true]); + $catalogCollection = flextype('content')->fetch('catalog', ['collection' => true]); $this->assertEquals(1, $catalogCollection->count()); $this->assertEquals('Bikes', $catalogCollection['catalog/bikes']['title']); $this->assertEquals('catalog/bikes', $catalogCollection['catalog/bikes']['id']); - $catalogLongCollecion = flextype('entries')->fetch('catalog', ['collection' => true, 'find' => ['depth' => ['>0', '<4']]]); + $catalogLongCollecion = flextype('content')->fetch('catalog', ['collection' => true, 'find' => ['depth' => ['>0', '<4']]]); $this->assertEquals(5, $catalogLongCollecion->count()); - $banner = flextype('entries')->fetch('banner'); + $banner = flextype('content')->fetch('banner'); $this->assertEquals('Banner', $banner['title']); $this->assertEquals('banner', $banner['id']); }); test('test entries field for albmus', function () { - flextype('entries')->create('root', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/entries/root/entry.md')->get())); + flextype('content')->create('root', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/entries/root/entry.md')->get())); - flextype('entries')->create('albums', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/entries/root/albums/entry.md')->get())); - flextype('entries')->create('albums/category-1', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/entries/root/albums/category-1/entry.md')->get())); - flextype('entries')->create('albums/category-1/album-1', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/entries/root/albums/category-1/album-1/entry.md')->get())); + flextype('content')->create('albums', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/entries/root/albums/entry.md')->get())); + flextype('content')->create('albums/category-1', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/entries/root/albums/category-1/entry.md')->get())); + flextype('content')->create('albums/category-1/album-1', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/entries/root/albums/category-1/album-1/entry.md')->get())); - flextype('entries')->create('banners', ['title' => 'Banners']); - flextype('entries')->create('banners/1', ['title' => 'Banner1']); - flextype('entries')->create('banners/2', ['title' => 'Banner2']); + flextype('content')->create('banners', ['title' => 'Banners']); + flextype('content')->create('banners/1', ['title' => 'Banner1']); + flextype('content')->create('banners/2', ['title' => 'Banner2']); - $root = flextype('entries')->fetch('root'); + $root = flextype('content')->fetch('root'); $this->assertEquals(16, $root->count()); }); test('test entries field for long nested entries', function () { - flextype('entries')->create('level1', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/entries/level1/entry.md')->get())); - flextype('entries')->create('level1/level2', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/entries/level1/level2/entry.md')->get())); - flextype('entries')->create('level1/level2/level3', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/entries/level1/level2/level3/entry.md')->get())); - flextype('entries')->create('level1/level2/level3/level4', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/entries/level1/level2/level3/level4/entry.md')->get())); + flextype('content')->create('level1', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/entries/level1/entry.md')->get())); + flextype('content')->create('level1/level2', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/entries/level1/level2/entry.md')->get())); + flextype('content')->create('level1/level2/level3', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/entries/level1/level2/level3/entry.md')->get())); + flextype('content')->create('level1/level2/level3/level4', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/entries/level1/level2/level3/level4/entry.md')->get())); - $level = flextype('entries')->fetch('level1'); + $level = flextype('content')->fetch('level1'); $this->assertEquals(14, $level->count()); $this->assertEquals('level1/level2', $level['root']['id']); @@ -94,13 +94,13 @@ test('test entries field for long nested entries', function () { }); test('test entries field for macroable fetch entries', function () { - flextype('entries')->create('macroable', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/entries/macroable/entry.md')->get())); + flextype('content')->create('macroable', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/entries/macroable/entry.md')->get())); - flextype('entries')::macro('fetchExtraData', function ($id, $options) { + flextype('content')::macro('fetchExtraData', function ($id, $options) { return ['id' => $id, 'options' => $options]; }); - $macroable = flextype('entries')->fetch('macroable'); + $macroable = flextype('content')->fetch('macroable'); $this->assertEquals('table', $macroable['table']['id']); $this->assertEquals('world', $macroable['table']['options']['hello']); diff --git a/tests/Foundation/Entries/Fields/IdFieldTest.php b/tests/Foundation/Entries/Fields/IdFieldTest.php index 129ff73c..d0cb7217 100644 --- a/tests/Foundation/Entries/Fields/IdFieldTest.php +++ b/tests/Foundation/Entries/Fields/IdFieldTest.php @@ -11,11 +11,11 @@ afterEach(function (): void { }); test('test IdField', function () { - flextype('entries')->create('foo', []); - $id = flextype('entries')->fetch('foo')['id']; + flextype('content')->create('foo', []); + $id = flextype('content')->fetch('foo')['id']; $this->assertEquals('foo', $id); - flextype('entries')->create('foo/bar', []); - $id = flextype('entries')->fetch('foo/bar')['id']; + flextype('content')->create('foo/bar', []); + $id = flextype('content')->fetch('foo/bar')['id']; $this->assertEquals('foo/bar', $id); }); diff --git a/tests/Foundation/Entries/Fields/MediaFieldTest.php b/tests/Foundation/Entries/Fields/MediaFieldTest.php index 33e9af4c..11721592 100644 --- a/tests/Foundation/Entries/Fields/MediaFieldTest.php +++ b/tests/Foundation/Entries/Fields/MediaFieldTest.php @@ -23,7 +23,7 @@ test('test media.files field', function () { filesystem()->file(PATH['project'] . '/media/bar.txt')->put('foo'); filesystem()->file(PATH['project'] . '/media/.meta/bar.txt.yaml')->put(flextype('serializers')->yaml()->encode(['title' => 'Bar', 'description' => '', 'type' => 'text/plain', 'filesize' => 3, 'uploaded_on' => 1603090370, 'exif' => []])); - flextype('entries')->create('media', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/entries/media/entry.md')->get())); + flextype('content')->create('media', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/entries/media/entry.md')->get())); flextype('media')->files()::macro('fetchExtraData', function ($id, $options) { return ['id' => $id, 'options' => $options]; @@ -33,7 +33,7 @@ test('test media.files field', function () { return ['id' => $id, 'options' => $options]; }); - $media = flextype('entries')->fetch('media'); + $media = flextype('content')->fetch('media'); $this->assertEquals('Media', $media['title']); $this->assertEquals('foo', $media['macroable_file']['id']); diff --git a/tests/Foundation/Entries/Fields/ModifiedAtFieldTest.php b/tests/Foundation/Entries/Fields/ModifiedAtFieldTest.php index 549b60af..764881db 100644 --- a/tests/Foundation/Entries/Fields/ModifiedAtFieldTest.php +++ b/tests/Foundation/Entries/Fields/ModifiedAtFieldTest.php @@ -11,9 +11,9 @@ afterEach(function (): void { }); test('test ModifiedAtField', function () { - flextype('entries')->create('foo', []); + flextype('content')->create('foo', []); - $modified_at = flextype('entries')->fetch('foo')['modified_at']; + $modified_at = flextype('content')->fetch('foo')['modified_at']; $this->assertTrue(strlen($modified_at) > 0); $this->assertTrue((ctype_digit($modified_at) && strtotime(date('Y-m-d H:i:s', $modified_at)) === (int)$modified_at)); diff --git a/tests/Foundation/Entries/Fields/ParsersFieldTest.php b/tests/Foundation/Entries/Fields/ParsersFieldTest.php index d8d44702..d604adb2 100644 --- a/tests/Foundation/Entries/Fields/ParsersFieldTest.php +++ b/tests/Foundation/Entries/Fields/ParsersFieldTest.php @@ -11,9 +11,9 @@ afterEach(function (): void { }); test('test ParsersField', function () { - flextype('entries')->create('foo', ['content' => '# Foo', 'parsers' => ['markdown' => ['enabled' => true, 'fields' => ['content']]]]); - $this->assertEquals(trim('

Foo

'), trim(flextype('entries')->fetch('foo')['content'])); + flextype('content')->create('foo', ['content' => '# Foo', 'parsers' => ['markdown' => ['enabled' => true, 'fields' => ['content']]]]); + $this->assertEquals(trim('

Foo

'), trim(flextype('content')->fetch('foo')['content'])); - flextype('entries')->create('bar', ['content' => '[registry_get name="Bar" default="Zed"]', 'parsers' => ['shortcode' => ['enabled' => true, 'fields' => ['content']]]]); - $this->assertEquals('Zed', flextype('entries')->fetch('bar')['content']); + flextype('content')->create('bar', ['content' => '[registry_get name="Bar" default="Zed"]', 'parsers' => ['shortcode' => ['enabled' => true, 'fields' => ['content']]]]); + $this->assertEquals('Zed', flextype('content')->fetch('bar')['content']); }); diff --git a/tests/Foundation/Entries/Fields/PublishedAtFieldTest.php b/tests/Foundation/Entries/Fields/PublishedAtFieldTest.php index 7d793980..adc74989 100644 --- a/tests/Foundation/Entries/Fields/PublishedAtFieldTest.php +++ b/tests/Foundation/Entries/Fields/PublishedAtFieldTest.php @@ -11,9 +11,9 @@ afterEach(function (): void { }); test('test PublishedAtField', function () { - flextype('entries')->create('foo', []); + flextype('content')->create('foo', []); - $published_at = flextype('entries')->fetch('foo')['published_at']; + $published_at = flextype('content')->fetch('foo')['published_at']; $this->assertTrue(strlen($published_at) > 0); $this->assertTrue((ctype_digit($published_at) && strtotime(date('Y-m-d H:i:s', $published_at)) === (int)$published_at)); diff --git a/tests/Foundation/Entries/Fields/PublishedByFieldTest.php b/tests/Foundation/Entries/Fields/PublishedByFieldTest.php index abd77bc7..02b02766 100644 --- a/tests/Foundation/Entries/Fields/PublishedByFieldTest.php +++ b/tests/Foundation/Entries/Fields/PublishedByFieldTest.php @@ -11,11 +11,11 @@ afterEach(function (): void { }); test('test PublishedByField', function () { - flextype('entries')->create('foo', []); - $published_by = flextype('entries')->fetch('foo')['published_by']; + flextype('content')->create('foo', []); + $published_by = flextype('content')->fetch('foo')['published_by']; $this->assertEquals('', $published_by); - flextype('entries')->create('bar', ['published_by' => 'Zed']); - $published_by = flextype('entries')->fetch('bar')['published_by']; + flextype('content')->create('bar', ['published_by' => 'Zed']); + $published_by = flextype('content')->fetch('bar')['published_by']; $this->assertEquals('Zed', $published_by); }); diff --git a/tests/Foundation/Entries/Fields/RegistryFieldTest.php b/tests/Foundation/Entries/Fields/RegistryFieldTest.php index 5ae27667..ab963c48 100644 --- a/tests/Foundation/Entries/Fields/RegistryFieldTest.php +++ b/tests/Foundation/Entries/Fields/RegistryFieldTest.php @@ -11,11 +11,11 @@ afterEach(function (): void { }); test('test registry field', function () { - flextype('entries')->create('registry-root', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/entries/registry-root/entry.md')->get())); - flextype('entries')->create('registry-root/level-1', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/entries/registry-root/level-1/entry.md')->get())); - flextype('entries')->create('registry-root/level-1/level-2', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/entries/registry-root/level-1/level-2/entry.md')->get())); + flextype('content')->create('registry-root', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/entries/registry-root/entry.md')->get())); + flextype('content')->create('registry-root/level-1', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/entries/registry-root/level-1/entry.md')->get())); + flextype('content')->create('registry-root/level-1/level-2', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/entries/registry-root/level-1/level-2/entry.md')->get())); - $data = flextype('entries')->fetch('registry-root'); + $data = flextype('content')->fetch('registry-root'); $this->assertEquals('Flextype', $data['flextype']); $this->assertEquals('Sergey Romanenko', $data['author']['name']); diff --git a/tests/Foundation/Entries/Fields/RoutableFieldTest.php b/tests/Foundation/Entries/Fields/RoutableFieldTest.php index cf89a370..1a22ef12 100644 --- a/tests/Foundation/Entries/Fields/RoutableFieldTest.php +++ b/tests/Foundation/Entries/Fields/RoutableFieldTest.php @@ -13,15 +13,15 @@ afterEach(function (): void { test('test RoutableField', function () { flextype('registry')->set('flextype.settings.cache.enabled', false); - flextype('entries')->create('foo', ['routable' => true]); - $routable = flextype('entries')->fetch('foo')['routable']; + flextype('content')->create('foo', ['routable' => true]); + $routable = flextype('content')->fetch('foo')['routable']; $this->assertTrue($routable); - flextype('entries')->create('bar', []); - $routable = flextype('entries')->fetch('bar')['routable']; + flextype('content')->create('bar', []); + $routable = flextype('content')->fetch('bar')['routable']; $this->assertTrue($routable); - flextype('entries')->create('zed', ['routable' => false]); - $routable = flextype('entries')->fetch('zed')['routable']; + flextype('content')->create('zed', ['routable' => false]); + $routable = flextype('content')->fetch('zed')['routable']; $this->assertFalse($routable); }); diff --git a/tests/Foundation/Entries/Fields/SlugFieldTest.php b/tests/Foundation/Entries/Fields/SlugFieldTest.php index 3e8feeba..5d15c8b4 100644 --- a/tests/Foundation/Entries/Fields/SlugFieldTest.php +++ b/tests/Foundation/Entries/Fields/SlugFieldTest.php @@ -11,11 +11,11 @@ afterEach(function (): void { }); test('test SlugField', function () { - flextype('entries')->create('foo', []); - $slug = flextype('entries')->fetch('foo')['slug']; + flextype('content')->create('foo', []); + $slug = flextype('content')->fetch('foo')['slug']; $this->assertEquals('foo', $slug); - flextype('entries')->create('bar', []); - $slug = flextype('entries')->fetch('bar')['slug']; + flextype('content')->create('bar', []); + $slug = flextype('content')->fetch('bar')['slug']; $this->assertEquals('bar', $slug); }); diff --git a/tests/Foundation/Entries/Fields/UuidFieldTest.php b/tests/Foundation/Entries/Fields/UuidFieldTest.php index 586a63bb..b39b478f 100644 --- a/tests/Foundation/Entries/Fields/UuidFieldTest.php +++ b/tests/Foundation/Entries/Fields/UuidFieldTest.php @@ -13,7 +13,7 @@ afterEach(function (): void { }); test('test UuidField', function () { - flextype('entries')->create('foo', []); - $uuid = flextype('entries')->fetch('foo')['uuid']; + flextype('content')->create('foo', []); + $uuid = flextype('content')->fetch('foo')['uuid']; $this->assertTrue(v::uuid()->validate($uuid)); }); diff --git a/tests/Foundation/Entries/Fields/VisibilityFieldTest.php b/tests/Foundation/Entries/Fields/VisibilityFieldTest.php index 888173dd..b50fd051 100644 --- a/tests/Foundation/Entries/Fields/VisibilityFieldTest.php +++ b/tests/Foundation/Entries/Fields/VisibilityFieldTest.php @@ -11,15 +11,15 @@ afterEach(function (): void { }); test('test VisibilityField', function () { - flextype('entries')->create('foo', []); - $visibility = flextype('entries')->fetch('foo')['visibility']; + flextype('content')->create('foo', []); + $visibility = flextype('content')->fetch('foo')['visibility']; $this->assertEquals('visible', $visibility); - flextype('entries')->create('bar', ['visibility' => 'draft']); - $visibility = flextype('entries')->fetch('bar')['visibility']; + flextype('content')->create('bar', ['visibility' => 'draft']); + $visibility = flextype('content')->fetch('bar')['visibility']; $this->assertEquals('draft', $visibility); - flextype('entries')->create('zed', ['visibility' => 'foobar']); - $visibility = flextype('entries')->fetch('zed')['visibility']; + flextype('content')->create('zed', ['visibility' => 'foobar']); + $visibility = flextype('content')->fetch('zed')['visibility']; $this->assertEquals('visible', $visibility); }); diff --git a/tests/Foundation/Helpers/FlextypHelperTest.php b/tests/Foundation/Helpers/FlextypHelperTest.php index e03fa00c..5b537a2e 100644 --- a/tests/Foundation/Helpers/FlextypHelperTest.php +++ b/tests/Foundation/Helpers/FlextypHelperTest.php @@ -20,7 +20,7 @@ test('test getInstance() method', function () { test('test container() method', function () { // get container - $this->assertInstanceOf(Entries::class, flextype('entries')); + $this->assertInstanceOf(Entries::class, flextype('content')); // set container flextype()->container()['foo'] = 'bar'; diff --git a/tests/Support/Helpers/FindHelperTest.php b/tests/Support/Helpers/FindHelperTest.php index 11a742d4..9e5e66f7 100644 --- a/tests/Support/Helpers/FindHelperTest.php +++ b/tests/Support/Helpers/FindHelperTest.php @@ -6,7 +6,7 @@ use Symfony\Component\Finder\Finder; beforeEach(function() { filesystem()->directory(PATH['project'] . '/entries')->create(0755, true); - flextype('entries')->create('foo', []); + flextype('content')->create('foo', []); }); afterEach(function (): void { diff --git a/tests/Support/Parsers/Shortcodes/EntriesShortcodeTest.php b/tests/Support/Parsers/Shortcodes/EntriesShortcodeTest.php index 1a9e4eb3..d0766ca7 100644 --- a/tests/Support/Parsers/Shortcodes/EntriesShortcodeTest.php +++ b/tests/Support/Parsers/Shortcodes/EntriesShortcodeTest.php @@ -11,7 +11,7 @@ afterEach(function (): void { }); test('test entries_fetch shortcode', function () { - $this->assertTrue(flextype('entries')->create('foo', ['title' => 'Foo'])); + $this->assertTrue(flextype('content')->create('foo', ['title' => 'Foo'])); $this->assertEquals('Foo', flextype('parsers')->shortcode()->process('[entries_fetch id="foo" field="title"]')); $this->assertEquals('Bar', flextype('parsers')->shortcode()->process('[entries_fetch id="foo" field="bar" default="Bar"]')); }); diff --git a/tests/Support/Parsers/Shortcodes/RawShortcodeTest.php b/tests/Support/Parsers/Shortcodes/RawShortcodeTest.php index 924b7bf3..9ecccb9f 100644 --- a/tests/Support/Parsers/Shortcodes/RawShortcodeTest.php +++ b/tests/Support/Parsers/Shortcodes/RawShortcodeTest.php @@ -11,7 +11,7 @@ afterEach(function (): void { }); test('test raw shortcode', function () { - $this->assertTrue(flextype('entries')->create('foo', ['title' => 'Foo'])); + $this->assertTrue(flextype('content')->create('foo', ['title' => 'Foo'])); $this->assertEquals('[entries_fetch id="foo" field="title"]', flextype('parsers')->shortcode()->process('[raw][entries_fetch id="foo" field="title"][/raw]')); });