From 11e09d33b783e48be6647bb5e68974526f92093c Mon Sep 17 00:00:00 2001 From: Awilum Date: Mon, 26 Jul 2021 22:01:03 +0300 Subject: [PATCH] feat(tests): update tests next round --- tests/Foundation/Content/ContentTest.php | 160 +++++++++--------- .../Content/Fields/ContentFieldTest.php | 68 ++++---- .../Content/Fields/CreatedAtFieldTest.php | 4 +- .../Content/Fields/CreatedByFieldTest.php | 8 +- .../Foundation/Content/Fields/IdFieldTest.php | 8 +- .../Content/Fields/ParsersFieldTest.php | 8 +- .../Content/Fields/PublishedAtFieldTest.php | 4 +- .../Content/Fields/PublishedByFieldTest.php | 8 +- .../Content/Fields/RegistryFieldTest.php | 8 +- .../Content/Fields/RoutableFieldTest.php | 12 +- .../Content/Fields/SlugFieldTest.php | 8 +- .../Foundation/Helpers/FlextypHelperTest.php | 2 +- .../Shortcodes/EntriesShortcodeTest.php | 2 +- .../Parsers/Shortcodes/RawShortcodeTest.php | 2 +- 14 files changed, 151 insertions(+), 151 deletions(-) diff --git a/tests/Foundation/Content/ContentTest.php b/tests/Foundation/Content/ContentTest.php index e5570b4d..bd0dc3b7 100644 --- a/tests/Foundation/Content/ContentTest.php +++ b/tests/Foundation/Content/ContentTest.php @@ -9,151 +9,151 @@ afterEach(function (): void { }); test('test create() method', function () { - $this->assertTrue(flextype('content')->create('foo', [])); - $this->assertFalse(flextype('content')->create('foo', [])); + $this->assertTrue(flextype('entries')->create('foo', [])); + $this->assertFalse(flextype('entries')->create('foo', [])); }); test('test has()', function () { - flextype('content')->create('foo', []); + flextype('entries')->create('foo', []); - $this->assertTrue(flextype('content')->has('foo')); - $this->assertFalse(flextype('content')->has('bar')); + $this->assertTrue(flextype('entries')->has('foo')); + $this->assertFalse(flextype('entries')->has('bar')); }); test('test update() method', function () { - flextype('content')->create('foo', []); + flextype('entries')->create('foo', []); - $this->assertTrue(flextype('content')->update('foo', ['title' => 'Test'])); - $this->assertFalse(flextype('content')->update('bar', ['title' => 'Test'])); + $this->assertTrue(flextype('entries')->update('foo', ['title' => 'Test'])); + $this->assertFalse(flextype('entries')->update('bar', ['title' => 'Test'])); }); test('test fetch() entry', function () { - 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']); + 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']); - $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(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('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']); + $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']); - 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()); + 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()); - $this->assertTrue(count(flextype('content')->fetch('foo', ['collection' => true])) > 0); + $this->assertTrue(count(flextype('entries')->fetch('foo', ['collection' => true])) > 0); /* - 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/zed.title', 'ZedFromCollection!'); }); - flextype('emitter')->addListener('onContentFetchCollectionHasResult', static function (): void { - flextype('content')->storage()->set('fetch_collection.data.foo/baz.title', 'BazFromCollection!'); + flextype('emitter')->addListener('onEntriesFetchCollectionHasResult', static function (): void { + flextype('entries')->storage()->set('fetch_collection.data.foo/baz.title', 'BazFromCollection!'); }); - $this->assertEquals('ZedFromCollection!', flextype('content')->fetch('foo', ['collection' => true])['foo/zed.title']); - $this->assertEquals('BazFromCollection!', flextype('content')->fetch('foo', ['collection' => true])['foo/baz.title']); + $this->assertEquals('ZedFromCollection!', flextype('entries')->fetch('foo', ['collection' => true])['foo/zed.title']); + $this->assertEquals('BazFromCollection!', flextype('entries')->fetch('foo', ['collection' => true])['foo/baz.title']); */ }); test('test copy() method', function () { - flextype('content')->create('foo', []); - flextype('content')->create('foo/bar', []); - flextype('content')->create('foo/baz', []); + flextype('entries')->create('foo', []); + flextype('entries')->create('foo/bar', []); + flextype('entries')->create('foo/baz', []); - flextype('content')->create('zed', []); - flextype('content')->copy('foo', 'zed'); + flextype('entries')->create('zed', []); + flextype('entries')->copy('foo', 'zed'); - $this->assertTrue(flextype('content')->has('zed')); + $this->assertTrue(flextype('entries')->has('zed')); }); test('test delete() method', function () { - flextype('content')->create('foo', []); - flextype('content')->create('foo/bar', []); - flextype('content')->create('foo/baz', []); + flextype('entries')->create('foo', []); + flextype('entries')->create('foo/bar', []); + flextype('entries')->create('foo/baz', []); - $this->assertTrue(flextype('content')->delete('foo')); - $this->assertFalse(flextype('content')->has('foo')); + $this->assertTrue(flextype('entries')->delete('foo')); + $this->assertFalse(flextype('entries')->has('foo')); }); test('test move() method', function () { - flextype('content')->create('foo', []); - flextype('content')->create('zed', []); + flextype('entries')->create('foo', []); + flextype('entries')->create('zed', []); - $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')); + $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')); }); test('test getFileLocation() method', function () { - flextype('content')->create('foo', []); + flextype('entries')->create('foo', []); $this->assertStringContainsString('/foo/entry.md', - flextype('content')->getFileLocation('foo')); + flextype('entries')->getFileLocation('foo')); }); test('test getDirectoryLocation() entry', function () { - flextype('content')->create('foo', []); + flextype('entries')->create('foo', []); $this->assertStringContainsString('/foo', - flextype('content')->getDirectoryLocation('foo')); + flextype('entries')->getDirectoryLocation('foo')); }); test('test getCacheID() entry', function () { flextype('registry')->set('flextype.settings.cache.enabled', false); - flextype('content')->create('foo', []); - $this->assertEquals('', flextype('content')->getCacheID('foo')); + flextype('entries')->create('foo', []); + $this->assertEquals('', flextype('entries')->getCacheID('foo')); flextype('registry')->set('flextype.settings.cache.enabled', true); - flextype('content')->create('bar', []); - $cache_id = flextype('content')->getCacheID('bar'); + flextype('entries')->create('bar', []); + $cache_id = flextype('entries')->getCacheID('bar'); $this->assertEquals(32, strlen($cache_id)); flextype('registry')->set('flextype.settings.cache.enabled', false); }); test('test storage() entry', function () { - 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')); + 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')); }); test('test macro() entry', function () { - flextype('content')->create('foo', []); - flextype('content')->create('foo/bar', []); - flextype('content')->create('foo/baz', []); + flextype('entries')->create('foo', []); + flextype('entries')->create('foo/bar', []); + flextype('entries')->create('foo/baz', []); - flextype('content')::macro('fetchRecentPosts', function($limit = 1) { - return flextype('content') + flextype('entries')::macro('fetchRecentPosts', function($limit = 1) { + return flextype('entries') ->fetch('foo') ->sortBy('published_at') ->limit($limit); }); - $this->assertEquals(1, flextype('content')->fetchRecentPosts()->count()); - $this->assertEquals(1, flextype('content')->fetchRecentPosts(1)->count()); - $this->assertEquals(2, flextype('content')->fetchRecentPosts(2)->count()); + $this->assertEquals(1, flextype('entries')->fetchRecentPosts()->count()); + $this->assertEquals(1, flextype('entries')->fetchRecentPosts(1)->count()); + $this->assertEquals(2, flextype('entries')->fetchRecentPosts(2)->count()); }); test('test mixin() entry', function () { - flextype('content')->create('foo', []); - flextype('content')->create('foo/bar', []); - flextype('content')->create('foo/baz', []); + flextype('entries')->create('foo', []); + flextype('entries')->create('foo/bar', []); + flextype('entries')->create('foo/baz', []); class FooMixin { public function foo() { @@ -169,9 +169,9 @@ test('test mixin() entry', function () { } } - flextype('content')::mixin(new FooMixin()); + flextype('entries')::mixin(new FooMixin()); - $this->assertEquals('Foo', flextype('content')->foo()); - $this->assertEquals('Foo', flextype('content')->bar()); - $this->assertEquals('Bar', flextype('content')->bar('Bar')); + $this->assertEquals('Foo', flextype('entries')->foo()); + $this->assertEquals('Foo', flextype('entries')->bar()); + $this->assertEquals('Bar', flextype('entries')->bar('Bar')); }); diff --git a/tests/Foundation/Content/Fields/ContentFieldTest.php b/tests/Foundation/Content/Fields/ContentFieldTest.php index 5d4b6524..44033601 100644 --- a/tests/Foundation/Content/Fields/ContentFieldTest.php +++ b/tests/Foundation/Content/Fields/ContentFieldTest.php @@ -11,11 +11,11 @@ afterEach(function (): void { }); test('test content field for blog', function () { - flextype('content')->create('blog', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/content/blog/entry.yaml')->get())); - flextype('content')->create('blog/post-1', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/content/blog/post-1/entry.yaml')->get())); - flextype('content')->create('blog/post-2', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/content/blog/post-2/entry.yaml')->get())); + flextype('entries')->create('blog', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/content/blog/entry.yaml')->get())); + flextype('entries')->create('blog/post-1', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/content/blog/post-1/entry.yaml')->get())); + flextype('entries')->create('blog/post-2', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/content/blog/post-2/entry.yaml')->get())); - $blog = flextype('content')->fetch('blog'); + $blog = flextype('entries')->fetch('blog'); $this->assertEquals(14, $blog->count()); }); @@ -23,22 +23,22 @@ test('test content field for blog', function () { test('test content field for catalog', function () { // Create catalog - flextype('content')->create('catalog', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/content/catalog/entry.yaml')->get())); - flextype('content')->create('catalog/bikes', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/content/catalog/bikes/entry.yaml')->get())); - flextype('content')->create('catalog/bikes/gt', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/content/catalog/bikes/gt/entry.yaml')->get())); - flextype('content')->create('catalog/bikes/norco', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/content/catalog/bikes/norco/entry.yaml')->get())); - flextype('content')->create('catalog/bikes/foo', ['title' => 'foo']); - flextype('content')->create('catalog/bikes/foo/bar', ['title' => 'bar']); + flextype('entries')->create('catalog', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/content/catalog/entry.yaml')->get())); + flextype('entries')->create('catalog/bikes', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/content/catalog/bikes/entry.yaml')->get())); + flextype('entries')->create('catalog/bikes/gt', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/content/catalog/bikes/gt/entry.yaml')->get())); + flextype('entries')->create('catalog/bikes/norco', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/content/catalog/bikes/norco/entry.yaml')->get())); + flextype('entries')->create('catalog/bikes/foo', ['title' => 'foo']); + flextype('entries')->create('catalog/bikes/foo/bar', ['title' => 'bar']); // Create discounts - 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']); + 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']); // Create banner - flextype('content')->create('banner', ['title' => 'Banner']); + flextype('entries')->create('banner', ['title' => 'Banner']); - $catalogSingle = flextype('content')->fetch('catalog'); + $catalogSingle = flextype('entries')->fetch('catalog'); $this->assertEquals(16, $catalogSingle->count()); $this->assertEquals('Catalog', $catalogSingle['title']); @@ -50,42 +50,42 @@ test('test content field for catalog', function () { $this->assertTrue(isset($catalogSingle['discounts']['discounts/30-off'])); $this->assertEquals('30% off', $catalogSingle['discounts']['discounts/30-off']['title']); - $catalogCollection = flextype('content')->fetch('catalog', ['collection' => true]); + $catalogCollection = flextype('entries')->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('content')->fetch('catalog', ['collection' => true, 'find' => ['depth' => ['>0', '<4']]]); + $catalogLongCollecion = flextype('entries')->fetch('catalog', ['collection' => true, 'find' => ['depth' => ['>0', '<4']]]); $this->assertEquals(5, $catalogLongCollecion->count()); - $banner = flextype('content')->fetch('banner'); + $banner = flextype('entries')->fetch('banner'); $this->assertEquals('Banner', $banner['title']); $this->assertEquals('banner', $banner['id']); }); test('test content field for albmus', function () { - flextype('content')->create('root', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/content/root/entry.yaml')->get())); + flextype('entries')->create('root', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/content/root/entry.yaml')->get())); - flextype('content')->create('albums', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/content/root/albums/entry.yaml')->get())); - flextype('content')->create('albums/category-1', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/content/root/albums/category-1/entry.yaml')->get())); - flextype('content')->create('albums/category-1/album-1', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/content/root/albums/category-1/album-1/entry.yaml')->get())); + flextype('entries')->create('albums', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/content/root/albums/entry.yaml')->get())); + flextype('entries')->create('albums/category-1', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/content/root/albums/category-1/entry.yaml')->get())); + flextype('entries')->create('albums/category-1/album-1', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/content/root/albums/category-1/album-1/entry.yaml')->get())); - flextype('content')->create('banners', ['title' => 'Banners']); - flextype('content')->create('banners/1', ['title' => 'Banner1']); - flextype('content')->create('banners/2', ['title' => 'Banner2']); + flextype('entries')->create('banners', ['title' => 'Banners']); + flextype('entries')->create('banners/1', ['title' => 'Banner1']); + flextype('entries')->create('banners/2', ['title' => 'Banner2']); - $root = flextype('content')->fetch('root'); + $root = flextype('entries')->fetch('root'); $this->assertEquals(16, $root->count()); }); test('test content field for long nested content', function () { - flextype('content')->create('level1', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/content/level1/entry.yaml')->get())); - flextype('content')->create('level1/level2', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/content/level1/level2/entry.yaml')->get())); - flextype('content')->create('level1/level2/level3', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/content/level1/level2/level3/entry.yaml')->get())); - flextype('content')->create('level1/level2/level3/level4', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/content/level1/level2/level3/level4/entry.yaml')->get())); + flextype('entries')->create('level1', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/content/level1/entry.yaml')->get())); + flextype('entries')->create('level1/level2', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/content/level1/level2/entry.yaml')->get())); + flextype('entries')->create('level1/level2/level3', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/content/level1/level2/level3/entry.yaml')->get())); + flextype('entries')->create('level1/level2/level3/level4', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/content/level1/level2/level3/level4/entry.yaml')->get())); - $level = flextype('content')->fetch('level1'); + $level = flextype('entries')->fetch('level1'); $this->assertEquals(14, $level->count()); $this->assertEquals('level1/level2', $level['root']['id']); @@ -94,13 +94,13 @@ test('test content field for long nested content', function () { }); test('test content field for macroable fetch content', function () { - flextype('content')->create('macroable', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/content/macroable/entry.yaml')->get())); + flextype('entries')->create('macroable', flextype('serializers')->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/Foundation/Entries/Fields/fixtures/content/macroable/entry.yaml')->get())); - flextype('content')::macro('fetchExtraData', function ($id, $options) { + flextype('entries')::macro('fetchExtraData', function ($id, $options) { return ['id' => $id, 'options' => $options]; }); - $macroable = flextype('content')->fetch('macroable'); + $macroable = flextype('entries')->fetch('macroable'); $this->assertEquals('table', $macroable['table']['id']); $this->assertEquals('world', $macroable['table']['options']['hello']); diff --git a/tests/Foundation/Content/Fields/CreatedAtFieldTest.php b/tests/Foundation/Content/Fields/CreatedAtFieldTest.php index fe7685bd..b9fc101e 100644 --- a/tests/Foundation/Content/Fields/CreatedAtFieldTest.php +++ b/tests/Foundation/Content/Fields/CreatedAtFieldTest.php @@ -12,8 +12,8 @@ afterEach(function (): void { test('test CreatedAtField', function () { // 1 - flextype('content')->create('foo', []); - $created_at = flextype('content')->fetch('foo')['created_at']; + flextype('entries')->create('foo', []); + $created_at = flextype('entries')->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/Content/Fields/CreatedByFieldTest.php b/tests/Foundation/Content/Fields/CreatedByFieldTest.php index cdcd7e0b..c97aa8c9 100644 --- a/tests/Foundation/Content/Fields/CreatedByFieldTest.php +++ b/tests/Foundation/Content/Fields/CreatedByFieldTest.php @@ -11,11 +11,11 @@ afterEach(function (): void { }); test('test CreatedByField', function () { - flextype('content')->create('foo', []); - $created_by = flextype('content')->fetch('foo')['created_by']; + flextype('entries')->create('foo', []); + $created_by = flextype('entries')->fetch('foo')['created_by']; $this->assertEquals('', $created_by); - flextype('content')->create('bar', ['created_by' => 'Zed']); - $created_by = flextype('content')->fetch('bar')['created_by']; + flextype('entries')->create('bar', ['created_by' => 'Zed']); + $created_by = flextype('entries')->fetch('bar')['created_by']; $this->assertEquals('Zed', $created_by); }); diff --git a/tests/Foundation/Content/Fields/IdFieldTest.php b/tests/Foundation/Content/Fields/IdFieldTest.php index d0cb7217..129ff73c 100644 --- a/tests/Foundation/Content/Fields/IdFieldTest.php +++ b/tests/Foundation/Content/Fields/IdFieldTest.php @@ -11,11 +11,11 @@ afterEach(function (): void { }); test('test IdField', function () { - flextype('content')->create('foo', []); - $id = flextype('content')->fetch('foo')['id']; + flextype('entries')->create('foo', []); + $id = flextype('entries')->fetch('foo')['id']; $this->assertEquals('foo', $id); - flextype('content')->create('foo/bar', []); - $id = flextype('content')->fetch('foo/bar')['id']; + flextype('entries')->create('foo/bar', []); + $id = flextype('entries')->fetch('foo/bar')['id']; $this->assertEquals('foo/bar', $id); }); diff --git a/tests/Foundation/Content/Fields/ParsersFieldTest.php b/tests/Foundation/Content/Fields/ParsersFieldTest.php index d604adb2..d8d44702 100644 --- a/tests/Foundation/Content/Fields/ParsersFieldTest.php +++ b/tests/Foundation/Content/Fields/ParsersFieldTest.php @@ -11,9 +11,9 @@ afterEach(function (): void { }); test('test ParsersField', function () { - 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('foo', ['content' => '# Foo', 'parsers' => ['markdown' => ['enabled' => true, 'fields' => ['content']]]]); + $this->assertEquals(trim('

Foo

'), trim(flextype('entries')->fetch('foo')['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']); + 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']); }); diff --git a/tests/Foundation/Content/Fields/PublishedAtFieldTest.php b/tests/Foundation/Content/Fields/PublishedAtFieldTest.php index adc74989..7d793980 100644 --- a/tests/Foundation/Content/Fields/PublishedAtFieldTest.php +++ b/tests/Foundation/Content/Fields/PublishedAtFieldTest.php @@ -11,9 +11,9 @@ afterEach(function (): void { }); test('test PublishedAtField', function () { - flextype('content')->create('foo', []); + flextype('entries')->create('foo', []); - $published_at = flextype('content')->fetch('foo')['published_at']; + $published_at = flextype('entries')->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/Content/Fields/PublishedByFieldTest.php b/tests/Foundation/Content/Fields/PublishedByFieldTest.php index 02b02766..abd77bc7 100644 --- a/tests/Foundation/Content/Fields/PublishedByFieldTest.php +++ b/tests/Foundation/Content/Fields/PublishedByFieldTest.php @@ -11,11 +11,11 @@ afterEach(function (): void { }); test('test PublishedByField', function () { - flextype('content')->create('foo', []); - $published_by = flextype('content')->fetch('foo')['published_by']; + flextype('entries')->create('foo', []); + $published_by = flextype('entries')->fetch('foo')['published_by']; $this->assertEquals('', $published_by); - flextype('content')->create('bar', ['published_by' => 'Zed']); - $published_by = flextype('content')->fetch('bar')['published_by']; + flextype('entries')->create('bar', ['published_by' => 'Zed']); + $published_by = flextype('entries')->fetch('bar')['published_by']; $this->assertEquals('Zed', $published_by); }); diff --git a/tests/Foundation/Content/Fields/RegistryFieldTest.php b/tests/Foundation/Content/Fields/RegistryFieldTest.php index ab963c48..5ae27667 100644 --- a/tests/Foundation/Content/Fields/RegistryFieldTest.php +++ b/tests/Foundation/Content/Fields/RegistryFieldTest.php @@ -11,11 +11,11 @@ afterEach(function (): void { }); test('test registry field', function () { - 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())); + 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())); - $data = flextype('content')->fetch('registry-root'); + $data = flextype('entries')->fetch('registry-root'); $this->assertEquals('Flextype', $data['flextype']); $this->assertEquals('Sergey Romanenko', $data['author']['name']); diff --git a/tests/Foundation/Content/Fields/RoutableFieldTest.php b/tests/Foundation/Content/Fields/RoutableFieldTest.php index 1a22ef12..cf89a370 100644 --- a/tests/Foundation/Content/Fields/RoutableFieldTest.php +++ b/tests/Foundation/Content/Fields/RoutableFieldTest.php @@ -13,15 +13,15 @@ afterEach(function (): void { test('test RoutableField', function () { flextype('registry')->set('flextype.settings.cache.enabled', false); - flextype('content')->create('foo', ['routable' => true]); - $routable = flextype('content')->fetch('foo')['routable']; + flextype('entries')->create('foo', ['routable' => true]); + $routable = flextype('entries')->fetch('foo')['routable']; $this->assertTrue($routable); - flextype('content')->create('bar', []); - $routable = flextype('content')->fetch('bar')['routable']; + flextype('entries')->create('bar', []); + $routable = flextype('entries')->fetch('bar')['routable']; $this->assertTrue($routable); - flextype('content')->create('zed', ['routable' => false]); - $routable = flextype('content')->fetch('zed')['routable']; + flextype('entries')->create('zed', ['routable' => false]); + $routable = flextype('entries')->fetch('zed')['routable']; $this->assertFalse($routable); }); diff --git a/tests/Foundation/Content/Fields/SlugFieldTest.php b/tests/Foundation/Content/Fields/SlugFieldTest.php index 5d15c8b4..3e8feeba 100644 --- a/tests/Foundation/Content/Fields/SlugFieldTest.php +++ b/tests/Foundation/Content/Fields/SlugFieldTest.php @@ -11,11 +11,11 @@ afterEach(function (): void { }); test('test SlugField', function () { - flextype('content')->create('foo', []); - $slug = flextype('content')->fetch('foo')['slug']; + flextype('entries')->create('foo', []); + $slug = flextype('entries')->fetch('foo')['slug']; $this->assertEquals('foo', $slug); - flextype('content')->create('bar', []); - $slug = flextype('content')->fetch('bar')['slug']; + flextype('entries')->create('bar', []); + $slug = flextype('entries')->fetch('bar')['slug']; $this->assertEquals('bar', $slug); }); diff --git a/tests/Foundation/Helpers/FlextypHelperTest.php b/tests/Foundation/Helpers/FlextypHelperTest.php index 5b537a2e..e03fa00c 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('content')); + $this->assertInstanceOf(Entries::class, flextype('entries')); // set container flextype()->container()['foo'] = 'bar'; diff --git a/tests/Support/Parsers/Shortcodes/EntriesShortcodeTest.php b/tests/Support/Parsers/Shortcodes/EntriesShortcodeTest.php index d0766ca7..1a9e4eb3 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('content')->create('foo', ['title' => 'Foo'])); + $this->assertTrue(flextype('entries')->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 9ecccb9f..924b7bf3 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('content')->create('foo', ['title' => 'Foo'])); + $this->assertTrue(flextype('entries')->create('foo', ['title' => 'Foo'])); $this->assertEquals('[entries_fetch id="foo" field="title"]', flextype('parsers')->shortcode()->process('[raw][entries_fetch id="foo" field="title"][/raw]')); });