@@ -44,9 +44,9 @@ discard block |
||
| 44 | 44 | $sortAscending ??= $publicationType->sortAscending; |
| 45 | 45 | $sortField ??= $publicationType->sortField; |
| 46 | 46 | |
| 47 | - return $publications->sortBy(function (PublicationPage $page) use ($sortField): mixed { |
|
| 47 | + return $publications->sortBy(function(PublicationPage $page) use ($sortField): mixed { |
|
| 48 | 48 | return $page->matter($sortField); |
| 49 | - }, descending: ! $sortAscending)->values()->toBase(); |
|
| 49 | + }, descending: !$sortAscending)->values()->toBase(); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | /** |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | public static function getMediaForType(PublicationType $publicationType): Collection |
| 56 | 56 | { |
| 57 | - return collect(MediaFile::all())->filter(function (MediaFile $file) use ($publicationType): bool { |
|
| 57 | + return collect(MediaFile::all())->filter(function(MediaFile $file) use ($publicationType): bool { |
|
| 58 | 58 | return Str::startsWith($file->getPath(), Hyde::getMediaDirectory().'/'.$publicationType->getDirectory()); |
| 59 | 59 | })->keys()->toBase(); |
| 60 | 60 | } |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | |
| 44 | 44 | if ($number >= 10000) { |
| 45 | 45 | $this->warn('Warning: Generating a large number of publications may take a while. <fg=gray>Expected time: '.($number / 1000).' seconds.</>'); |
| 46 | - if (! $this->confirm('Are you sure you want to continue?')) { |
|
| 46 | + if (!$this->confirm('Are you sure you want to continue?')) { |
|
| 47 | 47 | return parent::USER_EXIT; |
| 48 | 48 | } |
| 49 | 49 | } |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | public const TERMINATION_SEQUENCE = '<<<'; |
| 26 | 26 | public const END_OF_TRANSMISSION = "\x04"; |
| 27 | 27 | |
| 28 | - private static ?array $mockedStreamBuffer = null; |
|
| 28 | + private static ? array $mockedStreamBuffer = null; |
|
| 29 | 29 | |
| 30 | 30 | public static function call(): array |
| 31 | 31 | { |
@@ -179,8 +179,8 @@ |
||
| 179 | 179 | |
| 180 | 180 | protected function availableCanonicableFieldNames(): Collection |
| 181 | 181 | { |
| 182 | - return $this->fields->reject(function (PublicationFieldDefinition $field): bool { |
|
| 183 | - return ! in_array($field->type, PublicationFieldTypes::canonicable()); |
|
| 182 | + return $this->fields->reject(function(PublicationFieldDefinition $field): bool { |
|
| 183 | + return !in_array($field->type, PublicationFieldTypes::canonicable()); |
|
| 184 | 184 | })->pluck('name'); |
| 185 | 185 | } |
| 186 | 186 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | { |
| 66 | 66 | $this->timeStart = microtime(true); |
| 67 | 67 | |
| 68 | - if (! $this->option('json')) { |
|
| 68 | + if (!$this->option('json')) { |
|
| 69 | 69 | $this->title('Validating publications!'); |
| 70 | 70 | } |
| 71 | 71 | |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | $name = $this->argument('publicationType'); |
| 100 | 100 | |
| 101 | 101 | if (filled($name)) { |
| 102 | - if (! $publicationTypes->has($name)) { |
|
| 102 | + if (!$publicationTypes->has($name)) { |
|
| 103 | 103 | throw new InvalidArgumentException("Publication type [$name] does not exist"); |
| 104 | 104 | } |
| 105 | 105 | |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | |
| 182 | 182 | protected function getMessageTypesInResult(array $results): array |
| 183 | 183 | { |
| 184 | - return array_map(function (string $result): string { |
|
| 184 | + return array_map(function(string $result): string { |
|
| 185 | 185 | return explode(':', $result)[0]; |
| 186 | 186 | }, array_values($results)); |
| 187 | 187 | } |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | { |
| 46 | 46 | $timeStart = microtime(true); |
| 47 | 47 | |
| 48 | - if (! $this->option('json')) { |
|
| 48 | + if (!$this->option('json')) { |
|
| 49 | 49 | $this->title('Validating publication schemas!'); |
| 50 | 50 | } |
| 51 | 51 | |
@@ -40,8 +40,8 @@ discard block |
||
| 40 | 40 | public function test_can_seed_publications_using_arguments() |
| 41 | 41 | { |
| 42 | 42 | $this->artisan('seed:publications test-publication 1') |
| 43 | - ->expectsOutputToContain('Seeding new publications!') |
|
| 44 | - ->assertExitCode(0); |
|
| 43 | + ->expectsOutputToContain('Seeding new publications!') |
|
| 44 | + ->assertExitCode(0); |
|
| 45 | 45 | |
| 46 | 46 | $this->assertPublicationsCreated(); |
| 47 | 47 | } |
@@ -49,9 +49,9 @@ discard block |
||
| 49 | 49 | public function test_can_seed_multiple_publications() |
| 50 | 50 | { |
| 51 | 51 | $this->artisan('seed:publications test-publication 2') |
| 52 | - ->expectsOutputToContain('Seeding new publications!') |
|
| 53 | - ->expectsOutputToContain('2 publications for Test Publication created!') |
|
| 54 | - ->assertExitCode(0); |
|
| 52 | + ->expectsOutputToContain('Seeding new publications!') |
|
| 53 | + ->expectsOutputToContain('2 publications for Test Publication created!') |
|
| 54 | + ->assertExitCode(0); |
|
| 55 | 55 | |
| 56 | 56 | $this->assertPublicationsCreated(2); |
| 57 | 57 | } |
@@ -59,12 +59,12 @@ discard block |
||
| 59 | 59 | public function test_command_asks_to_confirm_before_creating_many_publications() |
| 60 | 60 | { |
| 61 | 61 | $this->artisan('seed:publications') |
| 62 | - ->expectsOutputToContain('Seeding new publications!') |
|
| 63 | - ->expectsQuestion('Which publication type would you like to seed?', 'test-publication') |
|
| 64 | - ->expectsQuestion('How many publications would you like to generate', 10000) |
|
| 65 | - ->expectsOutputToContain('Warning: Generating a large number of publications may take a while. Expected time: 10 seconds.') |
|
| 66 | - ->expectsConfirmation('Are you sure you want to continue?', false) |
|
| 67 | - ->assertExitCode(130); |
|
| 62 | + ->expectsOutputToContain('Seeding new publications!') |
|
| 63 | + ->expectsQuestion('Which publication type would you like to seed?', 'test-publication') |
|
| 64 | + ->expectsQuestion('How many publications would you like to generate', 10000) |
|
| 65 | + ->expectsOutputToContain('Warning: Generating a large number of publications may take a while. Expected time: 10 seconds.') |
|
| 66 | + ->expectsConfirmation('Are you sure you want to continue?', false) |
|
| 67 | + ->assertExitCode(130); |
|
| 68 | 68 | |
| 69 | 69 | $this->assertPublicationsCreated(0); |
| 70 | 70 | } |
@@ -72,10 +72,10 @@ discard block |
||
| 72 | 72 | public function test_command_asks_to_confirm_before_creating_many_publications_when_using_arguments() |
| 73 | 73 | { |
| 74 | 74 | $this->artisan('seed:publications test-publication 10000') |
| 75 | - ->expectsOutputToContain('Seeding new publications!') |
|
| 76 | - ->expectsOutputToContain('Warning: Generating a large number of publications may take a while. Expected time: 10 seconds.') |
|
| 77 | - ->expectsConfirmation('Are you sure you want to continue?', false) |
|
| 78 | - ->assertExitCode(130); |
|
| 75 | + ->expectsOutputToContain('Seeding new publications!') |
|
| 76 | + ->expectsOutputToContain('Warning: Generating a large number of publications may take a while. Expected time: 10 seconds.') |
|
| 77 | + ->expectsConfirmation('Are you sure you want to continue?', false) |
|
| 78 | + ->assertExitCode(130); |
|
| 79 | 79 | |
| 80 | 80 | $this->assertPublicationsCreated(0); |
| 81 | 81 | } |
@@ -27,11 +27,11 @@ discard block |
||
| 27 | 27 | $command = new ValidationTestCommand(); |
| 28 | 28 | $output = Mockery::mock(OutputStyle::class); |
| 29 | 29 | |
| 30 | - $output->shouldReceive('ask')->once()->withArgs(function (string $question) { |
|
| 30 | + $output->shouldReceive('ask')->once()->withArgs(function(string $question) { |
|
| 31 | 31 | return $question === 'What is your name?'; |
| 32 | 32 | })->andReturn('Jane Doe'); |
| 33 | 33 | |
| 34 | - $output->shouldReceive('writeln')->once()->withArgs(function (string $message) { |
|
| 34 | + $output->shouldReceive('writeln')->once()->withArgs(function(string $message) { |
|
| 35 | 35 | return $message === 'Hello Jane Doe!'; |
| 36 | 36 | }); |
| 37 | 37 | |
@@ -44,15 +44,15 @@ discard block |
||
| 44 | 44 | $command = new ValidationTestCommand(); |
| 45 | 45 | $output = Mockery::mock(OutputStyle::class); |
| 46 | 46 | |
| 47 | - $output->shouldReceive('ask')->times(2)->withArgs(function (string $question) { |
|
| 47 | + $output->shouldReceive('ask')->times(2)->withArgs(function(string $question) { |
|
| 48 | 48 | return $question === 'What is your name?'; |
| 49 | 49 | })->andReturn('', 'Jane Doe'); |
| 50 | 50 | |
| 51 | - $output->shouldReceive('writeln')->times(1)->withArgs(function (string $message) { |
|
| 51 | + $output->shouldReceive('writeln')->times(1)->withArgs(function(string $message) { |
|
| 52 | 52 | return $message === '<error>The name field is required.</error>'; |
| 53 | 53 | }); |
| 54 | 54 | |
| 55 | - $output->shouldReceive('writeln')->once()->withArgs(function (string $message) { |
|
| 55 | + $output->shouldReceive('writeln')->once()->withArgs(function(string $message) { |
|
| 56 | 56 | return $message === 'Hello Jane Doe!'; |
| 57 | 57 | }); |
| 58 | 58 | |
@@ -65,11 +65,11 @@ discard block |
||
| 65 | 65 | $command = new ValidationTestCommand(); |
| 66 | 66 | $output = Mockery::mock(OutputStyle::class); |
| 67 | 67 | |
| 68 | - $output->shouldReceive('ask')->times(30)->withArgs(function (string $question) { |
|
| 68 | + $output->shouldReceive('ask')->times(30)->withArgs(function(string $question) { |
|
| 69 | 69 | return $question === 'What is your name?'; |
| 70 | 70 | })->andReturn(''); |
| 71 | 71 | |
| 72 | - $output->shouldReceive('writeln')->times(30)->withArgs(function (string $message) { |
|
| 72 | + $output->shouldReceive('writeln')->times(30)->withArgs(function(string $message) { |
|
| 73 | 73 | return $message === '<error>The name field is required.</error>'; |
| 74 | 74 | }); |
| 75 | 75 | |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | $command->setOutput($output); |
| 80 | 80 | $command->handle(); |
| 81 | 81 | |
| 82 | - $output->shouldNotReceive('writeln')->once()->withArgs(function (string $message) { |
|
| 82 | + $output->shouldNotReceive('writeln')->once()->withArgs(function(string $message) { |
|
| 83 | 83 | return str_starts_with($message, 'Hello'); |
| 84 | 84 | }); |
| 85 | 85 | } |
@@ -88,17 +88,17 @@ discard block |
||
| 88 | 88 | { |
| 89 | 89 | $inputs = []; |
| 90 | 90 | $command = new DynamicValidatingTestCommand(); |
| 91 | - $command->closure = function (ValidatingCommand $command) use (&$inputs) { |
|
| 91 | + $command->closure = function(ValidatingCommand $command) use (&$inputs) { |
|
| 92 | 92 | $inputs[] = $command->askWithValidation('true', 'True?', ['boolean']); |
| 93 | 93 | $inputs[] = $command->askWithValidation('false', 'False?', ['boolean']); |
| 94 | 94 | }; |
| 95 | 95 | $output = Mockery::mock(OutputStyle::class); |
| 96 | 96 | |
| 97 | - $output->shouldReceive('ask')->once()->withArgs(function (string $question) { |
|
| 97 | + $output->shouldReceive('ask')->once()->withArgs(function(string $question) { |
|
| 98 | 98 | return $question === 'True?'; |
| 99 | 99 | })->andReturn('true'); |
| 100 | 100 | |
| 101 | - $output->shouldReceive('ask')->once()->withArgs(function (string $question) { |
|
| 101 | + $output->shouldReceive('ask')->once()->withArgs(function(string $question) { |
|
| 102 | 102 | return $question === 'False?'; |
| 103 | 103 | })->andReturn('false'); |
| 104 | 104 | |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | $output->shouldReceive('writeln')->once(); |
| 118 | 118 | |
| 119 | 119 | $validator = Validator::spy(); |
| 120 | - $validator->shouldReceive('make')->once()->withArgs(function (array $data, array $rules) { |
|
| 120 | + $validator->shouldReceive('make')->once()->withArgs(function(array $data, array $rules) { |
|
| 121 | 121 | return $data === ['name' => 'Jane Doe'] |
| 122 | 122 | && $rules === ['name' => ['required']]; |
| 123 | 123 | })->andReturn($validator); |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | $command = new ReloadableChoiceTestCommand(); |
| 133 | 133 | $output = Mockery::mock(OutputStyle::class); |
| 134 | 134 | |
| 135 | - $output->shouldReceive('askQuestion')->once()->withArgs(function (ChoiceQuestion $question) { |
|
| 135 | + $output->shouldReceive('askQuestion')->once()->withArgs(function(ChoiceQuestion $question) { |
|
| 136 | 136 | return $this->assertEqualsAsBoolean(new ChoiceQuestion('Select an option', [ |
| 137 | 137 | '<fg=bright-blue>[Reload options]</>', |
| 138 | 138 | 'foo', |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | ], null), $question); |
| 142 | 142 | })->andReturn('foo'); |
| 143 | 143 | |
| 144 | - $output->shouldReceive('writeln')->once()->withArgs(function (string $message) { |
|
| 144 | + $output->shouldReceive('writeln')->once()->withArgs(function(string $message) { |
|
| 145 | 145 | return $message === 'You selected foo'; |
| 146 | 146 | }); |
| 147 | 147 | |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | $command = new ReloadableChoiceTestCommand(); |
| 155 | 155 | $output = Mockery::mock(OutputStyle::class); |
| 156 | 156 | |
| 157 | - $output->shouldReceive('askQuestion')->once()->withArgs(function (ChoiceQuestion $question) { |
|
| 157 | + $output->shouldReceive('askQuestion')->once()->withArgs(function(ChoiceQuestion $question) { |
|
| 158 | 158 | return $this->assertEqualsAsBoolean(new ChoiceQuestion('Select an option', [ |
| 159 | 159 | '<fg=bright-blue>[Reload options]</>', |
| 160 | 160 | 'foo', |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | ], null), $question); |
| 164 | 164 | })->andReturn('<fg=bright-blue>[Reload options]</>'); |
| 165 | 165 | |
| 166 | - $output->shouldReceive('askQuestion')->once()->withArgs(function (ChoiceQuestion $question) { |
|
| 166 | + $output->shouldReceive('askQuestion')->once()->withArgs(function(ChoiceQuestion $question) { |
|
| 167 | 167 | return $this->assertEqualsAsBoolean(new ChoiceQuestion('Select an option', [ |
| 168 | 168 | '<fg=bright-blue>[Reload options]</>', |
| 169 | 169 | 'bar', |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | ], null), $question); |
| 173 | 173 | })->andReturn('qux'); |
| 174 | 174 | |
| 175 | - $output->shouldReceive('writeln')->once()->withArgs(function (string $message) { |
|
| 175 | + $output->shouldReceive('writeln')->once()->withArgs(function(string $message) { |
|
| 176 | 176 | return $message === 'You selected qux'; |
| 177 | 177 | }); |
| 178 | 178 | |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | |
| 210 | 210 | public function handle(): int |
| 211 | 211 | { |
| 212 | - $selection = $this->reloadableChoice(function () { |
|
| 212 | + $selection = $this->reloadableChoice(function() { |
|
| 213 | 213 | if ($this->isFirstRun) { |
| 214 | 214 | $this->isFirstRun = false; |
| 215 | 215 | |
@@ -185,8 +185,8 @@ |
||
| 185 | 185 | $this->file('test-publication/foo'); |
| 186 | 186 | |
| 187 | 187 | $this->artisan('make:publicationType "Test Publication"') |
| 188 | - ->expectsOutput('Error: Storage path [test-publication] already exists') |
|
| 189 | - ->assertExitCode(1); |
|
| 188 | + ->expectsOutput('Error: Storage path [test-publication] already exists') |
|
| 189 | + ->assertExitCode(1); |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | public function testWithTagFieldInput() |