Skip to content

Commit

Permalink
Update for changed publication type schema
Browse files Browse the repository at this point in the history
Update CreatesNewPublicationPageTest.php

Update CreatesNewPublicationType.php

Update test-publication-schema.json

Update MakePublicationCommandTest.php

Update MakePublicationTypeCommandTest.php

Update PublicationListPageTest.php

Update PublicationPageTest.php

Update PublicationPageUnitTest.php
  • Loading branch information
caendesilva committed Dec 5, 2022
1 parent 7b414b0 commit 00f8d49
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,14 @@ protected function handleCreate(): void
$type = new PublicationType(
$this->name,
$this->canonicalField,
$this->sortField,
$this->sortDirection,
$this->pageSize,
$this->prevNextLinks,
"{$this->dirName}_detail",
"{$this->dirName}_list",
[
$this->sortField,
$this->sortDirection,
$this->pageSize,
$this->prevNextLinks,
],
$this->fields->toArray()
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,15 @@ protected function makePublicationType(): PublicationType
return new PublicationType(
'test',
'title',
'sort',
'asc',
10,
true,
'detail',
'list',
[
fields: [
[
'type' => 'string',
'name' => 'title',
'min' => 0,
'max' => 128,
],
],
'test-publication',
directory: 'test-publication',
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,14 @@ protected function makeSchemaFile(): void
json_encode([
'name' => 'Test Publication',
'canonicalField' => 'title',
'sortField' => '__createdAt',
'sortDirection' => 'ASC',
'pageSize' => 10,
'prevNextLinks' => true,
'detailTemplate' => 'test-publication_detail',
'listTemplate' => 'test-publication_list',
'paginationSettings' => [
'pageSize' => 10,
'prevNextLinks' => true,
'sortField' => '__createdAt',
'sortDirection' => 'ASC',
],
'fields' => [
[
'name' => 'title',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,14 @@ public function test_command_creates_publication_type()
{
"name": "Test Publication",
"canonicalField": "publication-title",
"sortField": "__createdAt",
"sortDirection": "ASC",
"pageSize": 10,
"prevNextLinks": true,
"detailTemplate": "test-publication_detail",
"listTemplate": "test-publication_list",
"paginationSettings": {
"sortField": "__createdAt",
"sortDirection": "ASC",
"pageSize": 10,
"prevNextLinks": true
},
"fields": [
{
"type": "string",
Expand Down
10 changes: 6 additions & 4 deletions packages/framework/tests/Feature/PublicationListPageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,14 @@ protected function getTestData(): array
return [
'name' => 'test',
'canonicalField' => 'canonical',
'sortField' => 'sort',
'sortDirection' => 'asc',
'pageSize' => 10,
'prevNextLinks' => true,
'detailTemplate' => 'detail',
'listTemplate' => 'list',
'paginationSettings' => [
'sortField' => 'sort',
'sortDirection' => 'asc',
'pageSize' => 10,
'prevNextLinks' => true,
],
'fields' => [
'foo' => 'bar',
],
Expand Down
10 changes: 6 additions & 4 deletions packages/framework/tests/Feature/PublicationPageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,14 @@ protected function createRealPublicationFiles(): void
file_put_contents(Hyde::path('test-publication/schema.json'), '{
"name": "test",
"canonicalField": "slug",
"sortField": "__createdAt",
"sortDirection": "DESC",
"pageSize": 0,
"prevNextLinks": true,
"detailTemplate": "test_detail",
"listTemplate": "test_list",
"paginationSettings": {
"sortField": "__createdAt",
"sortDirection": "DESC",
"pageSize": 0,
"prevNextLinks": true
},
"fields": [
{
"name": "slug",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,12 +242,9 @@ protected function pubType(): PublicationType
return new PublicationType(
'name',
'canonicalField',
'sortField',
'sortDirection',
1,
true,
'detailTemplate',
'listTemplate',
['sortField', 'sortDirection', 1, true],
[],
'directory'
);
Expand Down
10 changes: 6 additions & 4 deletions tests/fixtures/test-publication-schema.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{
"name": "Test Publication",
"canonicalField": "title",
"sortField": "__createdAt",
"sortDirection": "DESC",
"pageSize": 25,
"prevNextLinks": true,
"detailTemplate": "test-publication_detail",
"listTemplate": "test-publication_list",
"paginationSettings": {
"sortField": "__createdAt",
"sortDirection": "DESC",
"pageSize": 25,
"prevNextLinks": true
},
"fields": [
{
"name": "title",
Expand Down

0 comments on commit 00f8d49

Please sign in to comment.