From 72c9b2583efff3957af813055e4d49f300a06529 Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Sat, 24 Dec 2022 11:43:05 +0100 Subject: [PATCH] Reorder questions to match data order --- .../Commands/MakePublicationTypeCommand.php | 14 +++++++------- .../Commands/MakePublicationTypeCommandTest.php | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/framework/src/Console/Commands/MakePublicationTypeCommand.php b/packages/framework/src/Console/Commands/MakePublicationTypeCommand.php index 3c35db41422..a8476e27b4a 100644 --- a/packages/framework/src/Console/Commands/MakePublicationTypeCommand.php +++ b/packages/framework/src/Console/Commands/MakePublicationTypeCommand.php @@ -49,7 +49,7 @@ public function safeHandle(): int $this->fields = $this->captureFieldsDefinitions(); - [$sortField, $sortAscending, $pageSize, $prevNextLinks] = ($this->getPaginationSettings()); + [$sortField, $sortAscending, $prevNextLinks, $pageSize] = ($this->getPaginationSettings()); $canonicalField = $this->getCanonicalField(); @@ -172,7 +172,7 @@ protected function getPaginationSettings(): array return [null, null, null, null]; } - return [$this->getSortField(), $this->getSortDirection(), $this->getPageSize(), $this->getPrevNextLinks()]; + return [$this->getSortField(), $this->getSortDirection(), $this->getPrevNextLinks(), $this->getPageSize()]; } protected function getSortField(): string @@ -187,6 +187,11 @@ protected function getSortDirection(): bool return $options[$this->choice('Choose the default sort direction', array_keys($options), 'Ascending')]; } + protected function getPrevNextLinks(): bool + { + return $this->confirm('Generate previous/next links in detail view?', true); + } + protected function getPageSize(): int { return (int) $this->askWithValidation('pageSize', @@ -196,11 +201,6 @@ protected function getPageSize(): int ); } - protected function getPrevNextLinks(): bool - { - return $this->confirm('Generate previous/next links in detail view?', true); - } - protected function getCount(int $offset = 0): int { return $this->fields->count() + $offset; diff --git a/packages/framework/tests/Feature/Commands/MakePublicationTypeCommandTest.php b/packages/framework/tests/Feature/Commands/MakePublicationTypeCommandTest.php index dc38a708419..682eca863c3 100644 --- a/packages/framework/tests/Feature/Commands/MakePublicationTypeCommandTest.php +++ b/packages/framework/tests/Feature/Commands/MakePublicationTypeCommandTest.php @@ -57,8 +57,8 @@ public function test_command_creates_publication_type() 'Ascending', 'Descending', ]) - ->expectsQuestion('Enter the page size (0 for no limit)', 10) ->expectsConfirmation('Generate previous/next links in detail view?', 'yes') + ->expectsQuestion('Enter the page size (0 for no limit)', 10) ->expectsChoice('Choose a canonical name field (this will be used to generate filenames, so the values need to be unique)', 'publication-title', [ '__createdAt', 'publication-title',