From ae9cb883689f9c72d34ed5cf44516a6ec0685bf4 Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Sun, 15 May 2022 12:46:53 +0000 Subject: [PATCH] Apply fixes from StyleCI [ci skip] [skip ci] --- src/Actions/CreatesDefaultDirectories.php | 3 +-- src/Services/BuildService.php | 4 ++-- src/Services/CollectionService.php | 11 ++++----- src/StaticPageBuilder.php | 2 +- tests/Feature/HydeBasePathCanBeChanged.php | 2 +- .../SourceDirectoriesCanBeChangedTest.php | 23 +++++++++---------- ...nFindModelFromCustomSourceFilePathTest.php | 2 -- 7 files changed, 21 insertions(+), 26 deletions(-) diff --git a/src/Actions/CreatesDefaultDirectories.php b/src/Actions/CreatesDefaultDirectories.php index 0959ac3f..75da2e5e 100644 --- a/src/Actions/CreatesDefaultDirectories.php +++ b/src/Actions/CreatesDefaultDirectories.php @@ -11,12 +11,11 @@ * @deprecated as Hyde is bringing support for changing the default directories. * The directories needed will be created (if needed) when the filesystem * needs to access them. The default directories may be created in the TestCase. - * + * * To prevent any issues with file generations, this action * is automatically whenever the application is booted. * * This behavior is handled in the Service Provider. - * * @see \Hyde\Framework\HydeServiceProvider */ class CreatesDefaultDirectories diff --git a/src/Services/BuildService.php b/src/Services/BuildService.php index 664293c5..6fbb8f43 100644 --- a/src/Services/BuildService.php +++ b/src/Services/BuildService.php @@ -9,9 +9,8 @@ /** * Static service helpers for building static pages. + * * @deprecated may be renamed to DiscoveryService - * - * @package HydeAutoDiscovery */ class BuildService { @@ -53,6 +52,7 @@ public static function getFilePathForModelClassFiles(string $model): string /** * Determine the Page Model to use for a given file path. + * * @see \Tests\Unit\BuildServiceCanFindModelFromCustomSourceFilePathTest * * @return string The model class constant, or false if none was found. diff --git a/src/Services/CollectionService.php b/src/Services/CollectionService.php index 84a16fd2..0ab05501 100644 --- a/src/Services/CollectionService.php +++ b/src/Services/CollectionService.php @@ -12,9 +12,8 @@ * Contains service methods to return helpful collections of arrays and lists. * * @see \Tests\Feature\Services\CollectionServiceTest + * * @todo refactor to use the source directories instead of hard-coded paths - * - * @package HydeAutoDiscovery */ class CollectionService { @@ -56,7 +55,7 @@ public static function getBladePageList(): array { $array = []; - foreach (glob(Hyde::path(BladePage::$sourceDirectory . '/*.blade.php')) as $filepath) { + foreach (glob(Hyde::path(BladePage::$sourceDirectory.'/*.blade.php')) as $filepath) { if (! str_starts_with(basename($filepath), '_')) { $array[] = basename($filepath, '.blade.php'); } @@ -74,7 +73,7 @@ public static function getMarkdownPageList(): array { $array = []; - foreach (glob(Hyde::path(MarkdownPage::$sourceDirectory . '/*.md')) as $filepath) { + foreach (glob(Hyde::path(MarkdownPage::$sourceDirectory.'/*.md')) as $filepath) { if (! str_starts_with(basename($filepath), '_')) { $array[] = basename($filepath, '.md'); } @@ -92,7 +91,7 @@ public static function getMarkdownPostList(): array { $array = []; - foreach (glob(Hyde::path(MarkdownPost::$sourceDirectory . '/*.md')) as $filepath) { + foreach (glob(Hyde::path(MarkdownPost::$sourceDirectory.'/*.md')) as $filepath) { if (! str_starts_with(basename($filepath), '_')) { $array[] = basename($filepath, '.md'); } @@ -110,7 +109,7 @@ public static function getDocumentationPageList(): array { $array = []; - foreach (glob(Hyde::path(DocumentationPage::$sourceDirectory. '/*.md')) as $filepath) { + foreach (glob(Hyde::path(DocumentationPage::$sourceDirectory.'/*.md')) as $filepath) { if (! str_starts_with(basename($filepath), '_')) { $array[] = basename($filepath, '.md'); } diff --git a/src/StaticPageBuilder.php b/src/StaticPageBuilder.php index 97803c93..69a9e0a4 100644 --- a/src/StaticPageBuilder.php +++ b/src/StaticPageBuilder.php @@ -11,7 +11,7 @@ /** * Converts a Page Model into a static HTML page. - * + * * @todo Create the required directories if they don't exist. * Can be done using a trait where an array of the required directories is passed. */ diff --git a/tests/Feature/HydeBasePathCanBeChanged.php b/tests/Feature/HydeBasePathCanBeChanged.php index a7bfc714..cdcba0bb 100644 --- a/tests/Feature/HydeBasePathCanBeChanged.php +++ b/tests/Feature/HydeBasePathCanBeChanged.php @@ -11,6 +11,6 @@ class HydeBasePathCanBeChanged extends TestCase { public function test_example() { - // TODO: Implement class + // TODO: Implement class } } diff --git a/tests/Feature/SourceDirectoriesCanBeChangedTest.php b/tests/Feature/SourceDirectoriesCanBeChangedTest.php index b9a03df5..619f6c4f 100644 --- a/tests/Feature/SourceDirectoriesCanBeChangedTest.php +++ b/tests/Feature/SourceDirectoriesCanBeChangedTest.php @@ -59,7 +59,7 @@ public function test_autodiscovery_discovers_posts_in_changed_directory() // Using a subdirectory in a directory we know exists, to make cleanup easier. mkdir(Hyde::path('_posts/test')); touch(Hyde::path('_posts/test/test.md')); - + MarkdownPost::$sourceDirectory = '_posts/test'; $this->assertEquals( @@ -70,12 +70,12 @@ public function test_autodiscovery_discovers_posts_in_changed_directory() unlink(Hyde::path('_posts/test/test.md')); rmdir(Hyde::path('_posts/test')); } - + public function test_markdown_posts_in_changed_directory_can_be_compiled() { mkdir(Hyde::path('testSourceDir/blog')); touch(Hyde::path('testSourceDir/blog/test.md')); - + MarkdownPost::$sourceDirectory = 'testSourceDir/blog'; // Uses the same logic as the BuildActionRunner for an accurate test. @@ -85,17 +85,17 @@ public function test_markdown_posts_in_changed_directory_can_be_compiled() 'test' )->get(), true - ); + ); $this->assertFileExists(Hyde::path('_site/posts/test.html')); unlink(Hyde::path('_site/posts/test.html')); } - + public function test_markdown_pages_in_changed_directory_can_be_compiled() { mkdir(Hyde::path('testSourceDir/pages')); touch(Hyde::path('testSourceDir/pages/test.md')); - + MarkdownPage::$sourceDirectory = 'testSourceDir/pages'; // Uses the same logic as the BuildActionRunner for an accurate test. @@ -105,7 +105,7 @@ public function test_markdown_pages_in_changed_directory_can_be_compiled() 'test' )->get(), true - ); + ); $this->assertFileExists(Hyde::path('_site/test.html')); unlink(Hyde::path('_site/test.html')); @@ -115,7 +115,7 @@ public function test_documentation_pages_in_changed_directory_can_be_compiled() { mkdir(Hyde::path('testSourceDir/documentation')); touch(Hyde::path('testSourceDir/documentation/test.md')); - + DocumentationPage::$sourceDirectory = 'testSourceDir/documentation'; // Uses the same logic as the BuildActionRunner for an accurate test. @@ -125,18 +125,17 @@ public function test_documentation_pages_in_changed_directory_can_be_compiled() 'test' )->get(), true - ); + ); $this->assertFileExists(Hyde::path('_site/docs/test.html')); unlink(Hyde::path('_site/docs/test.html')); } - public function test_blade_pages_in_changed_directory_can_be_compiled() { mkdir(Hyde::path('testSourceDir/blade')); touch(Hyde::path('testSourceDir/blade/test.blade.php')); - + BladePage::$sourceDirectory = 'testSourceDir/blade'; Config::set('view.paths', ['testSourceDir/blade']); @@ -147,7 +146,7 @@ public function test_blade_pages_in_changed_directory_can_be_compiled() 'test' )->get(), true - ); + ); $this->assertFileExists(Hyde::path('_site/test.html')); unlink(Hyde::path('_site/test.html')); diff --git a/tests/Unit/BuildServiceCanFindModelFromCustomSourceFilePathTest.php b/tests/Unit/BuildServiceCanFindModelFromCustomSourceFilePathTest.php index afd731e6..8ce7e018 100644 --- a/tests/Unit/BuildServiceCanFindModelFromCustomSourceFilePathTest.php +++ b/tests/Unit/BuildServiceCanFindModelFromCustomSourceFilePathTest.php @@ -2,14 +2,12 @@ namespace Tests\Unit; -use Hyde\Framework\Hyde; use Hyde\Framework\Models\BladePage; use Hyde\Framework\Models\DocumentationPage; use Hyde\Framework\Models\MarkdownPage; use Hyde\Framework\Models\MarkdownPost; use Hyde\Framework\Services\BuildService; use Illuminate\Support\Facades\Config; -use Illuminate\Support\Facades\File; use Tests\TestCase; /**