diff --git a/composer.json b/composer.json index 5b36069d..f9fa19c7 100644 --- a/composer.json +++ b/composer.json @@ -72,4 +72,4 @@ }, "minimum-stability": "dev", "prefer-stable": true -} +} \ No newline at end of file diff --git a/jigsaw b/jigsaw index 0655ea54..4d5734cf 100755 --- a/jigsaw +++ b/jigsaw @@ -23,9 +23,11 @@ $app->bootstrapWith([ ]); $application = new Symfony\Component\Console\Application('Jigsaw', '1.8.3'); -$application->add($app[TightenCo\Jigsaw\Console\InitCommand::class]); -$application->add(new TightenCo\Jigsaw\Console\BuildCommand($app)); -$application->add(new TightenCo\Jigsaw\Console\ServeCommand($app)); +$application->addCommands([ + $app[TightenCo\Jigsaw\Console\InitCommand::class], + new TightenCo\Jigsaw\Console\BuildCommand($app), + new TightenCo\Jigsaw\Console\ServeCommand($app), +]); $application->setCatchExceptions(false); TightenCo\Jigsaw\Jigsaw::addUserCommands($application, $app); diff --git a/src/Jigsaw.php b/src/Jigsaw.php index 4b337af8..209d75fe 100644 --- a/src/Jigsaw.php +++ b/src/Jigsaw.php @@ -61,9 +61,7 @@ public static function registerCommand($command) public static function addUserCommands($app, $container) { - foreach (self::$commands as $command) { - $app->add(new $command($container)); - } + $app->addCommands(array_map(fn ($command) => new $command($container), self::$commands)); } protected function buildCollections() diff --git a/tests/CollectionItemTest.php b/tests/CollectionItemTest.php index 0b9e223d..19458b53 100644 --- a/tests/CollectionItemTest.php +++ b/tests/CollectionItemTest.php @@ -240,9 +240,10 @@ public function collection_item_page_metadata_contains_modified_time() $this->buildSite($files, $config, $pretty = true); - $this->assertEquals( + $this->assertEqualsWithDelta( $files->getChild('build/collection/page/index.html')->filemtime(), $this->clean($files->getChild('build/collection/page/index.html')->getContent()), + 1, // allow mtimes to be within 1 second difference ); } } diff --git a/tests/SiteBuilderTest.php b/tests/SiteBuilderTest.php index e28ae2b3..718c24a2 100644 --- a/tests/SiteBuilderTest.php +++ b/tests/SiteBuilderTest.php @@ -109,9 +109,10 @@ public function page_metadata_contains_source_file_modified_time() $files = $this->setupSource(['page.blade.php' => '{{ $page->getModifiedTime() }}']); $this->buildSite($files, [], $pretty = true); - $this->assertEquals( + $this->assertEqualsWithDelta( $files->getChild('build/page/index.html')->filemtime(), $this->clean($files->getChild('build/page/index.html')->getContent()), + 1, // allow mtimes to be within 1 second difference ); }