From b386621e4ec7f852cb273c13e26d53de56873cf1 Mon Sep 17 00:00:00 2001 From: Jason Varga Date: Mon, 13 Feb 2023 14:25:56 -0500 Subject: [PATCH 01/19] remove bard extend --- resources/js/components/Bard.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/resources/js/components/Bard.js b/resources/js/components/Bard.js index 8434b7e3a78..bb61b80af26 100644 --- a/resources/js/components/Bard.js +++ b/resources/js/components/Bard.js @@ -8,11 +8,6 @@ class Bard { this.buttonCallbacks = []; } - /** @deprecated */ - extend(callback) { - this.addExtension(callback); - } - addExtension(callback) { this.extensionCallbacks.push(callback); } From 68a495b32659cc4d1ad8786d390ae33a431feffa Mon Sep 17 00:00:00 2001 From: Jason Varga Date: Mon, 13 Feb 2023 14:27:18 -0500 Subject: [PATCH 02/19] remove Config::getImageManipulationPresets, add tests --- src/Config.php | 14 ------ src/Facades/Config.php | 1 - tests/Facades/ConfigTest.php | 13 ------ tests/Facades/ImageTest.php | 41 ------------------ tests/Imaging/ManagerTest.php | 81 +++++++++++++++++++++++++++++++++++ 5 files changed, 81 insertions(+), 69 deletions(-) delete mode 100644 tests/Facades/ImageTest.php create mode 100644 tests/Imaging/ManagerTest.php diff --git a/src/Config.php b/src/Config.php index e73c43db509..950779ea750 100644 --- a/src/Config.php +++ b/src/Config.php @@ -2,7 +2,6 @@ namespace Statamic; -use Statamic\Facades\Image; use Statamic\Facades\Site; /** @@ -152,17 +151,4 @@ public function getSiteUrl($locale = null) { return $this->getSite($locale)->url(); } - - /** - * Get the image manipulation presets. - * - * @return array - * - * @deprecated Use Statamic\Facades\Image::userManipulationPresets() - * or Image::manipulationPresets() to get merged with CP presets. - */ - public function getImageManipulationPresets() - { - return Image::userManipulationPresets(); - } } diff --git a/src/Facades/Config.php b/src/Facades/Config.php index 563132127dd..4c5373719be 100644 --- a/src/Facades/Config.php +++ b/src/Facades/Config.php @@ -18,7 +18,6 @@ * @method static mixed getDefaultLocale() * @method static array getOtherLocales($locale = null) * @method static mixed getSiteUrl($locale = null) - * @method static array getImageManipulationPresets() * * @see \Statamic\Config */ diff --git a/tests/Facades/ConfigTest.php b/tests/Facades/ConfigTest.php index 10439c218a4..d25d971136f 100644 --- a/tests/Facades/ConfigTest.php +++ b/tests/Facades/ConfigTest.php @@ -143,19 +143,6 @@ public function gets_site_url() $this->assertEquals('http://test.com/de', Config::getSiteUrl('de')); } - /** @test */ - public function gets_image_manipulation_presets() - { - $presets = [ - 'small' => ['w' => 100], - 'large' => ['w' => 1000], - ]; - - config(['statamic.assets.image_manipulation.presets' => $presets]); - - $this->assertEquals($presets, Config::getImageManipulationPresets()); - } - private function fakeSiteConfig() { \Statamic\Facades\Site::setConfig([ diff --git a/tests/Facades/ImageTest.php b/tests/Facades/ImageTest.php deleted file mode 100644 index fbfd32caf7e..00000000000 --- a/tests/Facades/ImageTest.php +++ /dev/null @@ -1,41 +0,0 @@ -assertInstanceOf( - ImageManipulator::class, - Image::manipulator() - ); - } - - public function testManipulatorIsReturnedWhenNoItemIsPassed() - { - $this->assertInstanceOf( - ImageManipulator::class, - Image::manipulate() - ); - } - - public function testManipulatorIsReturnedWhenNoParamsArePassed() - { - $this->assertInstanceOf( - ImageManipulator::class, - Image::manipulate('foo.jpg') - ); - } - - public function testUrlIsReturnedWhenParamsAreSpecified() - { - $this->assertTrue( - is_string(Image::manipulate('foo.jpg', ['w' => 100])) - ); - } -} diff --git a/tests/Imaging/ManagerTest.php b/tests/Imaging/ManagerTest.php new file mode 100644 index 00000000000..14835d5196e --- /dev/null +++ b/tests/Imaging/ManagerTest.php @@ -0,0 +1,81 @@ +manager = new Manager; + } + + /** @test */ + public function manipulator_is_returned() + { + $this->assertInstanceOf( + ImageManipulator::class, + $this->manager->manipulator() + ); + } + + /** @test */ + public function manipulator_is_returned_when_no_item_is_passed() + { + $this->assertInstanceOf( + ImageManipulator::class, + $this->manager->manipulate() + ); + } + + /** @test */ + public function manipulator_is_returned_when_no_params_are_passed() + { + $this->assertInstanceOf( + ImageManipulator::class, + $this->manager->manipulate('foo.jpg') + ); + } + + /** @test */ + public function url_is_returned_when_params_are_specified() + { + $this->assertTrue( + is_string($this->manager->manipulate('foo.jpg', ['w' => 100])) + ); + } + + /** @test */ + public function it_gets_manipulation_presets() + { + config(['statamic.assets.image_manipulation.presets' => [ + 'alfa' => ['w' => 100, 'h' => 200, 'q' => 50, 'fit' => 'crop_focal'], // fit of crop_focal gets removed + 'bravo' => ['width' => 200, 'height' => 100, 'quality' => 20], // aliases get resolved + ]]); + + $this->assertEquals([ + 'alfa' => ['w' => 100, 'h' => 200, 'q' => 50], + 'bravo' => ['w' => 200, 'h' => 100, 'q' => 20], + ], $this->manager->userManipulationPresets()); + + $this->assertEquals([ + 'cp_thumbnail_small_landscape' => ['w' => '400', 'h' => '400', 'fit' => 'contain'], + 'cp_thumbnail_small_portrait' => ['h' => '400', 'fit' => 'contain'], + 'cp_thumbnail_small_square' => ['w' => '400', 'h' => '400'], + ], $this->manager->cpManipulationPresets()); + + $this->assertEquals([ + 'alfa' => ['w' => 100, 'h' => 200, 'q' => 50], + 'bravo' => ['w' => 200, 'h' => 100, 'q' => 20], + 'cp_thumbnail_small_landscape' => ['w' => '400', 'h' => '400', 'fit' => 'contain'], + 'cp_thumbnail_small_portrait' => ['h' => '400', 'fit' => 'contain'], + 'cp_thumbnail_small_square' => ['w' => '400', 'h' => '400'], + ], $this->manager->manipulationPresets()); + } +} From b59450243c774aace9ab2d384a45a235913f47d1 Mon Sep 17 00:00:00 2001 From: Jason Varga Date: Mon, 13 Feb 2023 14:29:39 -0500 Subject: [PATCH 03/19] remove dimensions --- src/Assets/Dimensions.php | 26 ------- tests/Assets/DimensionsTest.php | 118 -------------------------------- 2 files changed, 144 deletions(-) delete mode 100644 src/Assets/Dimensions.php delete mode 100644 tests/Assets/DimensionsTest.php diff --git a/src/Assets/Dimensions.php b/src/Assets/Dimensions.php deleted file mode 100644 index 6ca2875d97e..00000000000 --- a/src/Assets/Dimensions.php +++ /dev/null @@ -1,26 +0,0 @@ -get(), 0); - } - - public function height() - { - return array_get($this->get(), 1); - } -} diff --git a/tests/Assets/DimensionsTest.php b/tests/Assets/DimensionsTest.php deleted file mode 100644 index 2843d6eafbd..00000000000 --- a/tests/Assets/DimensionsTest.php +++ /dev/null @@ -1,118 +0,0 @@ -dimensions = new Dimensions(app(ImageGenerator::class)); - } - - /** @test */ - public function a_non_image_asset_has_no_dimensions() - { - $asset = $this->mock(Asset::class); - $asset->shouldReceive('isImage')->andReturnFalse(); - $asset->shouldReceive('isSvg')->andReturnFalse(); - $asset->shouldReceive('isAudio')->andReturnFalse(); - $asset->shouldReceive('isVideo')->andReturnFalse(); - - $dimensions = $this->dimensions->asset($asset); - - $this->assertEquals([null, null], $dimensions->get()); - $this->assertEquals(null, $dimensions->width()); - $this->assertEquals(null, $dimensions->height()); - } - - /** @test */ - public function it_gets_the_dimensions() - { - Carbon::setTestNow(now()); - - $asset = (new Asset) - ->container(AssetContainer::make('test-container')->disk('test')) - ->path('path/to/asset.jpg'); - - $file = UploadedFile::fake()->image('asset.jpg', 30, 60); - Storage::disk('test')->putFileAs('path/to', $file, 'asset.jpg'); - - // Test about the actual file, for good measure. - $realpath = Storage::disk('test')->path('path/to/asset.jpg'); - $this->assertFileExists($realpath); - $imagesize = getimagesize($realpath); - $this->assertEquals([30, 60], array_splice($imagesize, 0, 2)); - - $dimensions = $this->dimensions->asset($asset); - - $this->assertEquals([30, 60], $dimensions->get()); - $this->assertEquals(30, $dimensions->width()); - $this->assertEquals(60, $dimensions->height()); - } - - /** @test */ - public function it_gets_the_dimensions_of_an_svg() - { - $asset = $this->svgAsset(''); - - $this->assertEquals([30, 60], $this->dimensions->asset($asset)->get()); - } - - /** @test */ - public function it_uses_the_viewbox_if_the_svg_dimensions_havent_been_provided() - { - $asset = $this->svgAsset(''); - - $this->assertEquals([300, 600], $this->dimensions->asset($asset)->get()); - } - - /** @test */ - public function it_uses_the_viewbox_if_the_svg_dimensions_are_percents() - { - $asset = $this->svgAsset(''); - - $this->assertEquals([300, 600], $this->dimensions->asset($asset)->get()); - } - - /** @test */ - public function it_uses_the_viewbox_if_the_svg_dimensions_are_ems() - { - $asset = $this->svgAsset(''); - - $this->assertEquals([300, 600], $this->dimensions->asset($asset)->get()); - } - - /** @test */ - public function it_uses_default_dimensions_if_the_svg_has_no_viewbox_and_is_missing_either_or_both_dimensions() - { - $this->assertEquals([300, 150], $this->dimensions->asset($this->svgAsset(''))->get()); - $this->assertEquals([300, 150], $this->dimensions->asset($this->svgAsset(''))->get()); - $this->assertEquals([300, 150], $this->dimensions->asset($this->svgAsset(''))->get()); - } - - private function svgAsset($svg) - { - $asset = (new Asset) - ->container(AssetContainer::make('test-container')->disk('test')) - ->path('path/to/asset.svg'); - - Storage::disk('test')->put('path/to/asset.svg', $svg); - - return $asset; - } - } From a162a53400f82363b64f1aa5328edb344bde1646 Mon Sep 17 00:00:00 2001 From: Jason Varga Date: Mon, 13 Feb 2023 14:38:49 -0500 Subject: [PATCH 04/19] remove fromModel --- src/Auth/Eloquent/User.php | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/Auth/Eloquent/User.php b/src/Auth/Eloquent/User.php index a3728fc6b49..416ef4a83c6 100644 --- a/src/Auth/Eloquent/User.php +++ b/src/Auth/Eloquent/User.php @@ -20,14 +20,6 @@ class User extends BaseUser protected $roles; protected $groups; - /** @deprecated */ - public static function fromModel(Model $model) - { - return tap(new static, function ($user) use ($model) { - $user->model($model); - }); - } - public function model(Model $model = null) { if (is_null($model)) { From 45e814aa6c4552df2cfc8212a7943b1926aac8f6 Mon Sep 17 00:00:00 2001 From: Jason Varga Date: Mon, 13 Feb 2023 14:40:31 -0500 Subject: [PATCH 05/19] remove findbyslug --- src/Contracts/Entries/EntryRepository.php | 3 --- src/Contracts/Taxonomies/TermRepository.php | 3 --- src/Stache/Repositories/EntryRepository.php | 9 --------- src/Stache/Repositories/TermRepository.php | 9 --------- tests/Stache/FeatureTest.php | 10 ---------- .../Stache/Repositories/EntryRepositoryTest.php | 16 ---------------- 6 files changed, 50 deletions(-) diff --git a/src/Contracts/Entries/EntryRepository.php b/src/Contracts/Entries/EntryRepository.php index fbaf755aa69..6a46ad9956f 100644 --- a/src/Contracts/Entries/EntryRepository.php +++ b/src/Contracts/Entries/EntryRepository.php @@ -14,9 +14,6 @@ public function find($id); public function findByUri(string $uri); - /** @deprecated */ - public function findBySlug(string $slug, string $collection); - public function make(); public function query(); diff --git a/src/Contracts/Taxonomies/TermRepository.php b/src/Contracts/Taxonomies/TermRepository.php index cd454b7b62b..81ea9b0b8e4 100644 --- a/src/Contracts/Taxonomies/TermRepository.php +++ b/src/Contracts/Taxonomies/TermRepository.php @@ -14,9 +14,6 @@ public function find($id); public function findByUri(string $uri); - /** @deprecated */ - public function findBySlug(string $slug, string $collection); - public function make(string $slug = null); public function query(); diff --git a/src/Stache/Repositories/EntryRepository.php b/src/Stache/Repositories/EntryRepository.php index a658c949a4a..49b111f5029 100644 --- a/src/Stache/Repositories/EntryRepository.php +++ b/src/Stache/Repositories/EntryRepository.php @@ -43,15 +43,6 @@ public function find($id): ?Entry return $this->query()->where('id', $id)->first(); } - /** @deprecated */ - public function findBySlug(string $slug, string $collection): ?Entry - { - return $this->query() - ->where('slug', $slug) - ->where('collection', $collection) - ->first(); - } - public function findByUri(string $uri, string $site = null): ?Entry { $site = $site ?? $this->stache->sites()->first(); diff --git a/src/Stache/Repositories/TermRepository.php b/src/Stache/Repositories/TermRepository.php index fb193b68bba..affc765b753 100644 --- a/src/Stache/Repositories/TermRepository.php +++ b/src/Stache/Repositories/TermRepository.php @@ -91,15 +91,6 @@ public function findByUri(string $uri, string $site = null): ?Term return $term->collection($collection); } - /** @deprecated */ - public function findBySlug(string $slug, string $taxonomy): ?Term - { - return $this->query() - ->where('slug', $slug) - ->where('taxonomy', $taxonomy) - ->first(); - } - public function save($term) { $this->store diff --git a/tests/Stache/FeatureTest.php b/tests/Stache/FeatureTest.php index 52b108eb325..b8a413c6cb1 100644 --- a/tests/Stache/FeatureTest.php +++ b/tests/Stache/FeatureTest.php @@ -70,16 +70,6 @@ public function it_gets_entry() $this->assertNull(Entry::find('users-john')); } - /** - * @test - * - * @deprecated - **/ - public function it_gets_entry_by_slug() - { - $this->assertEquals('Christmas', Entry::findBySlug('christmas', 'blog', 'christmas')->get('title')); - } - /** @test */ public function it_gets_all_taxonomies() { diff --git a/tests/Stache/Repositories/EntryRepositoryTest.php b/tests/Stache/Repositories/EntryRepositoryTest.php index 2a3126aabd5..35baad9967c 100644 --- a/tests/Stache/Repositories/EntryRepositoryTest.php +++ b/tests/Stache/Repositories/EntryRepositoryTest.php @@ -139,22 +139,6 @@ public function it_gets_entry_by_id() /** * @test * - * @deprecated - **/ - public function it_gets_entry_by_slug() - { - $entry = $this->repo->findBySlug('bravo', 'alphabetical'); - - $this->assertInstanceOf(Entry::class, $entry); - $this->assertEquals('Bravo', $entry->get('title')); - - $this->assertNull($this->repo->findBySlug('unknown-slug', 'alphabetical')); - $this->assertNull($this->repo->findBySlug('bravo', 'unknown-collection')); - $this->assertNull($this->repo->findBySlug('unknown-slug', 'unknown-collection')); - } - - /** - * @test * @dataProvider entryByUriProvider */ public function it_gets_entry_by_uri($uri, $expectedTitle) From ffba41c20e169f248ab5e315799d4fbdddfb4bcd Mon Sep 17 00:00:00 2001 From: Jason Varga Date: Mon, 13 Feb 2023 14:41:33 -0500 Subject: [PATCH 06/19] remove utility register and push --- src/CP/Utilities/Utility.php | 6 ------ src/CP/Utilities/UtilityRepository.php | 8 -------- 2 files changed, 14 deletions(-) diff --git a/src/CP/Utilities/Utility.php b/src/CP/Utilities/Utility.php index 795d6b4c400..67c4ffab8ac 100644 --- a/src/CP/Utilities/Utility.php +++ b/src/CP/Utilities/Utility.php @@ -103,10 +103,4 @@ public function routes(Closure $routes = null) { return $this->fluentlyGetOrSet('routes')->args(func_get_args()); } - - /** @deprecated */ - public function register() - { - \Statamic\Facades\Utility::push($this); - } } diff --git a/src/CP/Utilities/UtilityRepository.php b/src/CP/Utilities/UtilityRepository.php index 7818c0fcec3..751f4b544ee 100644 --- a/src/CP/Utilities/UtilityRepository.php +++ b/src/CP/Utilities/UtilityRepository.php @@ -46,14 +46,6 @@ public function register($utility) return $utility; } - /** @deprecated */ - public function push(Utility $utility) - { - $this->register($utility); - - return $this; - } - public function all() { return $this->utilities; From 68a617d4ab99e7014bbdb3ecf8f7ed3f067621e2 Mon Sep 17 00:00:00 2001 From: Jason Varga Date: Mon, 13 Feb 2023 16:18:14 -0500 Subject: [PATCH 07/19] remove formsubmitted form property --- src/Events/FormSubmitted.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Events/FormSubmitted.php b/src/Events/FormSubmitted.php index db64c405d30..434887e2091 100644 --- a/src/Events/FormSubmitted.php +++ b/src/Events/FormSubmitted.php @@ -8,13 +8,9 @@ class FormSubmitted extends Event { public $submission; - /** @deprecated */ - public $form; - public function __construct(Submission $submission) { $this->submission = $submission; - $this->form = $submission; // deprecated } /** From 948970776550dea6d974256717d4f2e5cb02b224 Mon Sep 17 00:00:00 2001 From: Jason Varga Date: Mon, 13 Feb 2023 16:20:06 -0500 Subject: [PATCH 08/19] remove field isvisible --- src/Fields/Field.php | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/Fields/Field.php b/src/Fields/Field.php index bfcd20e46e9..75b8f417845 100644 --- a/src/Fields/Field.php +++ b/src/Fields/Field.php @@ -199,14 +199,6 @@ public function isVisibleOnListing() return ! in_array($this->get('listable'), [false, 'hidden'], true); } - /** - * @deprecated Use isVisibleOnListing() instead. - */ - public function isVisible() - { - return $this->isVisibleOnListing(); - } - public function isSortable() { if (is_null($this->get('sortable'))) { From 5ceca462e8155f1ca72ed8bc938ae4a68da4c274 Mon Sep 17 00:00:00 2001 From: Jason Varga Date: Mon, 13 Feb 2023 16:21:20 -0500 Subject: [PATCH 09/19] remove field toblueprintarray --- src/Fields/Field.php | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/Fields/Field.php b/src/Fields/Field.php index 75b8f417845..f2b82e0ff88 100644 --- a/src/Fields/Field.php +++ b/src/Fields/Field.php @@ -241,20 +241,6 @@ public function toPublishArray() ]); } - /** - * @deprecated - */ - public function toBlueprintArray() - { - return [ - 'handle' => $this->handle, - 'type' => $this->type(), - 'display' => $this->display(), - 'instructions' => $this->instructions(), - 'config' => array_except($this->preProcessedConfig(), 'type'), - ]; - } - public function setValue($value) { $this->value = $value; From 35b181f9aa701564f05be630cda892dcd27e5455 Mon Sep 17 00:00:00 2001 From: Jason Varga Date: Mon, 13 Feb 2023 16:21:49 -0500 Subject: [PATCH 10/19] remove image getCpImageManipulationPresets --- src/Imaging/Manager.php | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/Imaging/Manager.php b/src/Imaging/Manager.php index 3130950e225..6ae586b26fa 100644 --- a/src/Imaging/Manager.php +++ b/src/Imaging/Manager.php @@ -86,14 +86,6 @@ public function cpManipulationPresets() ]; } - /** - * @deprecated - */ - public function getCpImageManipulationPresets() - { - return $this->cpManipulationPresets(); - } - /** * Normalize preset. * From 19b62c0f31ed47745eaa97753875757bebaf0de7 Mon Sep 17 00:00:00 2001 From: Jason Varga Date: Mon, 13 Feb 2023 16:23:02 -0500 Subject: [PATCH 11/19] remove utility push test --- tests/CP/Utilities/UtilityRepositoryTest.php | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/tests/CP/Utilities/UtilityRepositoryTest.php b/tests/CP/Utilities/UtilityRepositoryTest.php index fdbbce1f70c..c90be300c4c 100644 --- a/tests/CP/Utilities/UtilityRepositoryTest.php +++ b/tests/CP/Utilities/UtilityRepositoryTest.php @@ -9,12 +9,8 @@ class UtilityRepositoryTest extends TestCase { - /** - * @test - * - * @dataProvider registerMethodProvider - */ - public function it_registers_a_utility($registerMethod) + /** @test */ + public function it_registers_a_utility() { $utilities = new UtilityRepository; $this->assertInstanceOf(Collection::class, $utilities->all()); @@ -23,19 +19,11 @@ public function it_registers_a_utility($registerMethod) $utility = $utilities->make('one'); $this->assertCount(0, $utilities->all()); - $utilities->$registerMethod($utility); + $utilities->register($utility); $this->assertEquals(['one' => $utility], $utilities->all()->all()); $this->assertEquals($utility, $utilities->find('one')); } - public function registerMethodProvider() - { - return [ - 'register' => ['register'], - 'push' => ['push'], // @deprecated - ]; - } - /** @test */ public function it_registers_a_utility_via_a_string() { From a4098333641b247c88ab738c3134f6d57768c7be Mon Sep 17 00:00:00 2001 From: Jason Varga Date: Mon, 13 Feb 2023 16:32:33 -0500 Subject: [PATCH 12/19] Remove format_localized modifier and i10n alias --- src/Modifiers/CoreModifiers.php | 14 -------------- src/Providers/ExtensionServiceProvider.php | 1 - 2 files changed, 15 deletions(-) diff --git a/src/Modifiers/CoreModifiers.php b/src/Modifiers/CoreModifiers.php index b10893424a4..03f49b1b517 100644 --- a/src/Modifiers/CoreModifiers.php +++ b/src/Modifiers/CoreModifiers.php @@ -756,20 +756,6 @@ public function formatTranslated($value, $params) return $this->carbon($value)->translatedFormat(Arr::get($params, 0)); } - /** - * Converts a string to a Carbon instance and formats it according to the whim of the Overlord. - * - * @deprecated formatLocalized is deprecated since Carbon 2.55.0. You may want to use isoFormat instead. - * - * @param $value - * @param $params - * @return string - */ - public function formatLocalized($value, $params) - { - return $this->carbon($value)->formatLocalized(Arr::get($params, 0)); - } - /** * Format a number with grouped thousands and decimal points. * diff --git a/src/Providers/ExtensionServiceProvider.php b/src/Providers/ExtensionServiceProvider.php index db30aeb9928..871ceb6c9d8 100644 --- a/src/Providers/ExtensionServiceProvider.php +++ b/src/Providers/ExtensionServiceProvider.php @@ -119,7 +119,6 @@ class ExtensionServiceProvider extends ServiceProvider 'piped' => 'optionList', 'json' => 'toJson', 'email' => 'obfuscateEmail', - 'l10n' => 'formatLocalized', 'lowercase' => 'lower', 'tz' => 'timezone', 'inFuture' => 'isFuture', From b28a84f86e0367dfbb62613b73ac2ba13899d2c2 Mon Sep 17 00:00:00 2001 From: Jason Varga Date: Mon, 13 Feb 2023 16:35:20 -0500 Subject: [PATCH 13/19] remove structurestore --- src/Stache/Stores/StructuresStore.php | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 src/Stache/Stores/StructuresStore.php diff --git a/src/Stache/Stores/StructuresStore.php b/src/Stache/Stores/StructuresStore.php deleted file mode 100644 index c4a9491d08f..00000000000 --- a/src/Stache/Stores/StructuresStore.php +++ /dev/null @@ -1,13 +0,0 @@ - Date: Mon, 13 Feb 2023 16:57:03 -0500 Subject: [PATCH 14/19] remove tree page --- src/Actions/DuplicateEntry.php | 2 +- src/Entries/Entry.php | 2 +- .../CP/Collections/CollectionTreeController.php | 2 +- .../Controllers/CP/Collections/EntriesController.php | 6 +++--- src/Stache/Repositories/EntryRepository.php | 2 +- src/Structures/Tree.php | 12 ++---------- src/Structures/TreeBuilder.php | 2 +- tests/Data/Entries/EntryTest.php | 2 +- tests/Data/Structures/TreeTest.php | 4 ++-- 9 files changed, 13 insertions(+), 21 deletions(-) diff --git a/src/Actions/DuplicateEntry.php b/src/Actions/DuplicateEntry.php index 83c865ea18f..388f513c74d 100644 --- a/src/Actions/DuplicateEntry.php +++ b/src/Actions/DuplicateEntry.php @@ -66,7 +66,7 @@ protected function getEntryParentFromStructure(Entry $entry) $parentEntry = $entry ->structure() ->in($entry->locale()) - ->page($entry->id()) + ->find($entry->id()) ->parent(); if (! $parentEntry) { diff --git a/src/Entries/Entry.php b/src/Entries/Entry.php index b43e6b02598..b97a67659fc 100644 --- a/src/Entries/Entry.php +++ b/src/Entries/Entry.php @@ -676,7 +676,7 @@ public function page() return null; } - return $this->structure()->in($this->locale())->page($id); + return $this->structure()->in($this->locale())->find($id); } public function route() diff --git a/src/Http/Controllers/CP/Collections/CollectionTreeController.php b/src/Http/Controllers/CP/Collections/CollectionTreeController.php index 8f2235b578f..5c848b4e194 100644 --- a/src/Http/Controllers/CP/Collections/CollectionTreeController.php +++ b/src/Http/Controllers/CP/Collections/CollectionTreeController.php @@ -68,7 +68,7 @@ private function validateUniqueUris($tree) } foreach ($tree->diff()->moved() as $id) { - $page = $tree->page($id); + $page = $tree->find($id); $parent = $page->parent(); $siblings = (! $parent || $parent->isRoot()) diff --git a/src/Http/Controllers/CP/Collections/EntriesController.php b/src/Http/Controllers/CP/Collections/EntriesController.php index 5ce575e753e..d26a630afe2 100644 --- a/src/Http/Controllers/CP/Collections/EntriesController.php +++ b/src/Http/Controllers/CP/Collections/EntriesController.php @@ -225,7 +225,7 @@ public function update(Request $request, $collection, $entry) $this->validateParent($entry, $tree, $parent); $entry->afterSave(function ($entry) use ($parent, $tree) { - if ($parent && optional($tree->page($parent))->isRoot()) { + if ($parent && optional($tree->find($parent))->isRoot()) { $parent = null; } @@ -379,7 +379,7 @@ public function store(Request $request, $collection, $site) if ($structure && ! $collection->orderable()) { $parent = $values['parent'] ?? null; $entry->afterSave(function ($entry) use ($parent, $tree) { - if ($parent && optional($tree->page($parent))->isRoot()) { + if ($parent && optional($tree->find($parent))->isRoot()) { $parent = null; } @@ -537,7 +537,7 @@ private function entryUri($entry, $tree, $parent) return $entry->uri(); } - $parent = $parent ? $tree->page($parent) : null; + $parent = $parent ? $tree->find($parent) : null; return app(\Statamic\Contracts\Routing\UrlBuilder::class) ->content($entry) diff --git a/src/Stache/Repositories/EntryRepository.php b/src/Stache/Repositories/EntryRepository.php index 49b111f5029..6d28608e5f4 100644 --- a/src/Stache/Repositories/EntryRepository.php +++ b/src/Stache/Repositories/EntryRepository.php @@ -65,7 +65,7 @@ public function findByUri(string $uri, string $site = null): ?Entry } return $entry->hasStructure() - ? $entry->structure()->in($site)->page($entry->id()) + ? $entry->structure()->in($site)->find($entry->id()) : $entry; } diff --git a/src/Structures/Tree.php b/src/Structures/Tree.php index ed0da6ff6ea..7146ff41590 100644 --- a/src/Structures/Tree.php +++ b/src/Structures/Tree.php @@ -140,14 +140,6 @@ public function uriCacheEnabled() return $this->uriCacheEnabled; } - /** - * @deprecated Use find() instead. - */ - public function page($id): ?Page - { - return $this->find($id); - } - public function find($id): ?Page { return $this->flattenedPages() @@ -245,7 +237,7 @@ public function append($entry) public function appendTo($parent, $page) { - if ($parent && ! $this->page($parent)) { + if ($parent && ! $this->find($parent)) { throw new \Exception("Page [{$parent}] does not exist in this structure"); } @@ -287,7 +279,7 @@ private function appendToInBranches($parent, $page, $branches) public function move($entry, $target) { - $parent = optional($this->page($entry)->parent()); + $parent = optional($this->find($entry)->parent()); if ($parent->id() === $target || $parent->isRoot() && is_null($target)) { return $this; diff --git a/src/Structures/TreeBuilder.php b/src/Structures/TreeBuilder.php index 1b4ab89e02c..a45a60eaf90 100644 --- a/src/Structures/TreeBuilder.php +++ b/src/Structures/TreeBuilder.php @@ -34,7 +34,7 @@ public function build($params) $entry = ($from && $from !== '/') ? Entry::findByUri(Str::start($from, '/'), $params['site']) : null; if ($entry) { - $page = $tree->page($entry->id()); + $page = $tree->find($entry->id()); $pages = $page->pages()->all(); } else { $pages = $tree->pages() diff --git a/tests/Data/Entries/EntryTest.php b/tests/Data/Entries/EntryTest.php index c65900f9693..7e6e43074d3 100644 --- a/tests/Data/Entries/EntryTest.php +++ b/tests/Data/Entries/EntryTest.php @@ -1861,7 +1861,7 @@ public function it_gets_the_corresponding_page_from_the_collections_structure() $page->shouldReceive('parent')->andReturn($parentPage); $tree = $this->partialMock(CollectionTree::class); $tree->locale('en'); - $tree->shouldReceive('page')->with('entry-id')->andReturn($page); + $tree->shouldReceive('find')->with('entry-id')->andReturn($page); CollectionTreeRepository::shouldReceive('find', 'en')->andReturn($tree); $structure = new CollectionStructure; diff --git a/tests/Data/Structures/TreeTest.php b/tests/Data/Structures/TreeTest.php index a209e062a0c..273aa6c68f0 100644 --- a/tests/Data/Structures/TreeTest.php +++ b/tests/Data/Structures/TreeTest.php @@ -145,9 +145,9 @@ public function it_gets_the_child_pages_including_the_root() } /** @test */ - public function it_gets_a_page_by_id() + public function it_find_a_page_by_id() { - $page = $this->tree()->page('pages-directors'); + $page = $this->tree()->find('pages-directors'); $this->assertEquals('Custom Directors Title', $page->title()); } From fa8508852c36f456152f7682c2aeeccf553f45fb Mon Sep 17 00:00:00 2001 From: Jason Varga Date: Mon, 13 Feb 2023 16:58:27 -0500 Subject: [PATCH 15/19] remove github release presenter --- .../Presenters/GithubReleasePresenter.php | 54 ------------------- 1 file changed, 54 deletions(-) delete mode 100644 src/Updater/Presenters/GithubReleasePresenter.php diff --git a/src/Updater/Presenters/GithubReleasePresenter.php b/src/Updater/Presenters/GithubReleasePresenter.php deleted file mode 100644 index c9b8f24b50c..00000000000 --- a/src/Updater/Presenters/GithubReleasePresenter.php +++ /dev/null @@ -1,54 +0,0 @@ -githubRelease = $githubRelease; - } - - /** - * Convert github release to HTML. - * - * @return string - */ - public function toHtml() - { - $string = Html::markdown($this->githubRelease ?: '- [na] Changelog unavailable.'); - - // TODO: Move to blade or vue? Or leave in presenter? - // TODO: Create tailwind classes for these labels. - $string = Str::replace($string, '[new]', 'NEW'); - $string = Str::replace($string, '[fix]', 'FIX'); - $string = Str::replace($string, '[break]', 'BREAK'); - $string = Str::replace($string, '[na]', 'N/A'); - - return $string; - } - - /** - * Output to HTML when cast as string. - * - * @return string - */ - public function __toString() - { - return $this->toHtml(); - } -} From b5608538876d8cfacb3fb09d283e2fcb4ff3f1b7 Mon Sep 17 00:00:00 2001 From: Jason Varga Date: Mon, 13 Feb 2023 17:57:21 -0500 Subject: [PATCH 16/19] replace assertFileNotExists with assertFileDoesNotExist --- tests/Composer/ComposerLockBackupTest.php | 16 +-- tests/Composer/ComposerTest.php | 30 ++--- tests/Console/Commands/MakeActionTest.php | 4 +- tests/Console/Commands/MakeAddonTest.php | 8 +- tests/Console/Commands/MakeFieldtypeTest.php | 8 +- tests/Console/Commands/MakeFilterTest.php | 6 +- tests/Console/Commands/MakeModifierTest.php | 6 +- tests/Console/Commands/MakeScopeTest.php | 6 +- tests/Console/Commands/MakeTagTest.php | 6 +- tests/Console/Commands/MakeWidgetTest.php | 6 +- tests/Filesystem/FilesystemAdapterTests.php | 12 +- tests/Imaging/GlideTest.php | 2 +- tests/Preferences/DefaultPreferencesTest.php | 6 +- .../Repositories/EntryRepositoryTest.php | 2 +- tests/Stache/Stores/EntriesStoreTest.php | 24 ++-- tests/Stache/Stores/TermsStoreTest.php | 2 +- tests/StarterKits/ExportTest.php | 32 ++--- tests/StarterKits/InstallTest.php | 114 +++++++++--------- tests/StarterKits/RunPostInstallTest.php | 8 +- tests/TestCase.php | 10 -- tests/UpdateScripts/UpdateScriptTest.php | 8 +- 21 files changed, 148 insertions(+), 168 deletions(-) diff --git a/tests/Composer/ComposerLockBackupTest.php b/tests/Composer/ComposerLockBackupTest.php index a9d1969dd8e..1706afd5d87 100644 --- a/tests/Composer/ComposerLockBackupTest.php +++ b/tests/Composer/ComposerLockBackupTest.php @@ -34,7 +34,7 @@ public function it_can_backup_existing_lock_file() file_put_contents($this->lockPath, $content = 'test lock file content'); $this->assertFileExists($this->lockPath); - $this->assertFileNotExists($this->backupLockPath); + $this->assertFileDoesNotExist($this->backupLockPath); Lock::backup(); @@ -47,7 +47,7 @@ public function it_doesnt_throw_exception_when_attempting_to_backup_non_existend { Lock::backup('non-existent-file.lock'); - $this->assertFileNotExists($this->backupLockPath); + $this->assertFileDoesNotExist($this->backupLockPath); } /** @test */ @@ -60,7 +60,7 @@ public function it_can_backup_lock_file_from_custom_location() file_put_contents($this->customLockPath, $content = 'custom lock file content'); $this->assertFileExists($this->customLockPath); - $this->assertFileNotExists($this->customBackupLockPath); + $this->assertFileDoesNotExist($this->customBackupLockPath); Lock::backup($this->customLockPath); @@ -83,14 +83,4 @@ private function removeLockFiles() } } } - - /** - * @deprecated - */ - public static function assertFileNotExists(string $filename, string $message = ''): void - { - method_exists(static::class, 'assertFileDoesNotExist') - ? static::assertFileDoesNotExist($filename, $message) - : parent::assertFileNotExists($filename, $message); - } } diff --git a/tests/Composer/ComposerTest.php b/tests/Composer/ComposerTest.php index fa95226a7b6..ada0d140d25 100644 --- a/tests/Composer/ComposerTest.php +++ b/tests/Composer/ComposerTest.php @@ -126,7 +126,7 @@ public function it_can_require_update_downgrade_and_remove_a_package() // Test that the package isn't installed yet... $this->assertNotContains('test/package', Composer::installed()->keys()); - $this->assertFileNotExists($this->basePath('vendor/test/package')); + $this->assertFileDoesNotExist($this->basePath('vendor/test/package')); $this->assertFalse(Cache::has('composer.test/package')); // Test that we can require a package... @@ -170,7 +170,7 @@ public function it_can_require_update_downgrade_and_remove_a_package() Composer::remove('test/package'); $this->assertStringNotContainsString('test/package', Composer::installed()->keys()); - $this->assertFileNotExists($this->basePath('vendor/test/package')); + $this->assertFileDoesNotExist($this->basePath('vendor/test/package')); $this->assertStringContainsString('Removing test/package', Cache::get('composer.test/package')['output']); // Test that we can add extra params when requiring... @@ -180,7 +180,7 @@ public function it_can_require_update_downgrade_and_remove_a_package() $installed = Composer::installed(); $this->assertFalse($installed->keys()->contains('test/package')); - $this->assertFileNotExists($this->basePath('vendor/test/package')); + $this->assertFileDoesNotExist($this->basePath('vendor/test/package')); $this->assertStringContainsString('Installing test/package', Cache::get('composer.test/package')['output']); // Test that we can add extra params when requiring a dev dependency... @@ -190,7 +190,7 @@ public function it_can_require_update_downgrade_and_remove_a_package() $installed = Composer::installed(); $this->assertFalse($installed->keys()->contains('test/package')); - $this->assertFileNotExists($this->basePath('vendor/test/package')); + $this->assertFileDoesNotExist($this->basePath('vendor/test/package')); $this->assertStringContainsString('Installing test/package', Cache::get('composer.test/package')['output']); // Test that we can require a package as a dev dependency... @@ -210,7 +210,7 @@ public function it_can_require_update_downgrade_and_remove_a_package() Composer::removeDev('test/package'); $this->assertStringNotContainsString('test/package', Composer::installed()->keys()); - $this->assertFileNotExists($this->basePath('vendor/test/package')); + $this->assertFileDoesNotExist($this->basePath('vendor/test/package')); $this->assertStringContainsString('Removing test/package', Cache::get('composer.test/package')['output']); } @@ -242,8 +242,8 @@ public function it_can_require_and_remove_multiple_packages_in_one_shot() $this->assertNotContains('test/one', Composer::installed()->keys()); $this->assertNotContains('test/two', Composer::installed()->keys()); - $this->assertFileNotExists($this->basePath('vendor/test/one')); - $this->assertFileNotExists($this->basePath('vendor/test/two')); + $this->assertFileDoesNotExist($this->basePath('vendor/test/one')); + $this->assertFileDoesNotExist($this->basePath('vendor/test/two')); // Test that we can require multiple packages... @@ -272,8 +272,8 @@ public function it_can_require_and_remove_multiple_packages_in_one_shot() $output = Cache::get('composer.test/one')['output']; $this->assertStringNotContainsString('test/one', Composer::installed()->keys()); $this->assertStringNotContainsString('test/two', Composer::installed()->keys()); - $this->assertFileNotExists($this->basePath('vendor/test/one')); - $this->assertFileNotExists($this->basePath('vendor/test/two')); + $this->assertFileDoesNotExist($this->basePath('vendor/test/one')); + $this->assertFileDoesNotExist($this->basePath('vendor/test/two')); $this->assertStringContainsString('Removing test/one', $output); $this->assertStringContainsString('Removing test/two', $output); @@ -284,8 +284,8 @@ public function it_can_require_and_remove_multiple_packages_in_one_shot() $output = Cache::get('composer.test/one')['output']; $this->assertStringNotContainsString('test/one', Composer::installed()->keys()); $this->assertStringNotContainsString('test/two', Composer::installed()->keys()); - $this->assertFileNotExists($this->basePath('vendor/test/one')); - $this->assertFileNotExists($this->basePath('vendor/test/two')); + $this->assertFileDoesNotExist($this->basePath('vendor/test/one')); + $this->assertFileDoesNotExist($this->basePath('vendor/test/two')); $this->assertStringContainsString('Installing test/one', $output); $this->assertStringContainsString('Installing test/two', $output); @@ -296,8 +296,8 @@ public function it_can_require_and_remove_multiple_packages_in_one_shot() $output = Cache::get('composer.test/one')['output']; $this->assertStringNotContainsString('test/one', Composer::installed()->keys()); $this->assertStringNotContainsString('test/two', Composer::installed()->keys()); - $this->assertFileNotExists($this->basePath('vendor/test/one')); - $this->assertFileNotExists($this->basePath('vendor/test/two')); + $this->assertFileDoesNotExist($this->basePath('vendor/test/one')); + $this->assertFileDoesNotExist($this->basePath('vendor/test/two')); $this->assertStringContainsString('Installing test/one', $output); $this->assertStringContainsString('Installing test/two', $output); @@ -328,8 +328,8 @@ public function it_can_require_and_remove_multiple_packages_in_one_shot() $output = Cache::get('composer.test/one')['output']; $this->assertStringNotContainsString('test/one', Composer::installed()->keys()); $this->assertStringNotContainsString('test/two', Composer::installed()->keys()); - $this->assertFileNotExists($this->basePath('vendor/test/one')); - $this->assertFileNotExists($this->basePath('vendor/test/two')); + $this->assertFileDoesNotExist($this->basePath('vendor/test/one')); + $this->assertFileDoesNotExist($this->basePath('vendor/test/two')); $this->assertStringContainsString('Removing test/one', $output); $this->assertStringContainsString('Removing test/two', $output); } diff --git a/tests/Console/Commands/MakeActionTest.php b/tests/Console/Commands/MakeActionTest.php index eefe017210a..fc1b8d148a0 100644 --- a/tests/Console/Commands/MakeActionTest.php +++ b/tests/Console/Commands/MakeActionTest.php @@ -31,7 +31,7 @@ public function it_can_make_an_action() { $path = base_path('app/Actions/Delete.php'); - $this->assertFileNotExists($path); + $this->assertFileDoesNotExist($path); $this->artisan('statamic:make:action', ['name' => 'Delete']); @@ -78,7 +78,7 @@ public function it_can_make_an_action_into_an_addon() Composer::shouldReceive('installedPath')->andReturn($path); - $this->assertFileNotExists($action = "$path/src/Actions/Yoda.php"); + $this->assertFileDoesNotExist($action = "$path/src/Actions/Yoda.php"); $this->artisan('statamic:make:action', ['name' => 'Yoda', 'addon' => 'yoda/bag-odah']); diff --git a/tests/Console/Commands/MakeAddonTest.php b/tests/Console/Commands/MakeAddonTest.php index a913c30dfa3..532d2bd88bd 100644 --- a/tests/Console/Commands/MakeAddonTest.php +++ b/tests/Console/Commands/MakeAddonTest.php @@ -31,7 +31,7 @@ public function tearDown(): void /** @test */ public function it_can_generate_an_addon() { - $this->assertFileNotExists(base_path('addons/hasselhoff/knight-rider')); + $this->assertFileDoesNotExist(base_path('addons/hasselhoff/knight-rider')); $this->makeAddon('hasselhoff/knight-rider'); @@ -54,7 +54,7 @@ public function it_cannot_make_addon_with_invalid_composer_package_name() $this->artisan('statamic:make:addon', ['addon' => 'some/path/deaths-tar-vulnerability']) ->expectsOutput('Please enter a valid composer package name (eg. hasselhoff/kung-fury).'); - $this->assertFileNotExists(base_path('addons/erso/deaths-tar-vulnerability')); + $this->assertFileDoesNotExist(base_path('addons/erso/deaths-tar-vulnerability')); } /** @test */ @@ -93,7 +93,7 @@ public function it_can_generate_with_a_fieldtype() { $this->fakeSuccessfulComposerInstall(); - $this->assertFileNotExists(base_path('addons/hasselhoff/knight-rider')); + $this->assertFileDoesNotExist(base_path('addons/hasselhoff/knight-rider')); $this->makeAddon('hasselhoff/knight-rider', ['--fieldtype' => true]); @@ -118,7 +118,7 @@ public function it_can_make_an_addon_with_everything_including_the_kitchen_sink( $path = base_path('addons/ford/san-holo'); - $this->assertFileNotExists($path); + $this->assertFileDoesNotExist($path); $this->artisan('statamic:make:addon', ['addon' => 'ford/san-holo', '--all' => true]); diff --git a/tests/Console/Commands/MakeFieldtypeTest.php b/tests/Console/Commands/MakeFieldtypeTest.php index 4a90edeb6da..2675e4459a3 100644 --- a/tests/Console/Commands/MakeFieldtypeTest.php +++ b/tests/Console/Commands/MakeFieldtypeTest.php @@ -29,8 +29,8 @@ public function tearDown(): void /** @test */ public function it_can_generate_a_fieldtype() { - $this->assertFileNotExists(base_path('app/Fieldtypes/KnightRider.php')); - $this->assertFileNotExists(resource_path('js/components/fieldtypes/KnightRider.vue')); + $this->assertFileDoesNotExist(base_path('app/Fieldtypes/KnightRider.php')); + $this->assertFileDoesNotExist(resource_path('js/components/fieldtypes/KnightRider.vue')); $this->artisan('statamic:make:fieldtype', ['name' => 'KnightRider']); @@ -47,7 +47,7 @@ public function it_will_not_overwrite_an_existing_fieldtype() { $path = base_path('app/Fieldtypes/KnightRider.php'); - $this->assertFileNotExists($path); + $this->assertFileDoesNotExist($path); $this->artisan('statamic:make:fieldtype', ['name' => 'KnightRider']); $this->files->put($path, 'overwritten fieldtype'); @@ -83,7 +83,7 @@ public function it_can_make_a_fieldtype_into_an_addon() Composer::shouldReceive('installedPath')->andReturn($path); - $this->assertFileNotExists($fieldtype = "$path/src/Fieldtypes/Yoda.php"); + $this->assertFileDoesNotExist($fieldtype = "$path/src/Fieldtypes/Yoda.php"); $this->artisan('statamic:make:fieldtype', ['name' => 'Yoda', 'addon' => 'yoda/bag-odah']); diff --git a/tests/Console/Commands/MakeFilterTest.php b/tests/Console/Commands/MakeFilterTest.php index b941f24e9f2..aa65029f9df 100644 --- a/tests/Console/Commands/MakeFilterTest.php +++ b/tests/Console/Commands/MakeFilterTest.php @@ -31,7 +31,7 @@ public function it_can_make_a_filter() { $path = base_path('app/Scopes/Mouse.php'); - $this->assertFileNotExists($path); + $this->assertFileDoesNotExist($path); $this->artisan('statamic:make:filter', ['name' => 'Mouse']); @@ -44,7 +44,7 @@ public function it_will_not_overwrite_an_existing_filter() { $path = base_path('app/Scopes/Mouse.php'); - $this->assertFileNotExists($path); + $this->assertFileDoesNotExist($path); $this->artisan('statamic:make:filter', ['name' => 'Mouse']); $this->files->put($path, 'overwritten filter'); @@ -80,7 +80,7 @@ public function it_can_make_a_filter_into_an_addon() Composer::shouldReceive('installedPath')->andReturn($path); - $this->assertFileNotExists($filter = "$path/src/Scopes/Yoda.php"); + $this->assertFileDoesNotExist($filter = "$path/src/Scopes/Yoda.php"); $this->artisan('statamic:make:filter', ['name' => 'Yoda', 'addon' => 'yoda/bag-odah']); diff --git a/tests/Console/Commands/MakeModifierTest.php b/tests/Console/Commands/MakeModifierTest.php index 4539dc3f2e3..bc53f891c15 100644 --- a/tests/Console/Commands/MakeModifierTest.php +++ b/tests/Console/Commands/MakeModifierTest.php @@ -31,7 +31,7 @@ public function it_can_make_a_modifier() { $path = base_path('app/Modifiers/Giraffe.php'); - $this->assertFileNotExists($path); + $this->assertFileDoesNotExist($path); $this->artisan('statamic:make:modifier', ['name' => 'Giraffe']); @@ -44,7 +44,7 @@ public function it_will_not_overwrite_an_existing_modifier() { $path = base_path('app/Modifiers/Giraffe.php'); - $this->assertFileNotExists($path); + $this->assertFileDoesNotExist($path); $this->artisan('statamic:make:modifier', ['name' => 'Giraffe']); $this->files->put($path, 'overwritten modifier'); @@ -80,7 +80,7 @@ public function it_can_make_a_modifier_into_an_addon() Composer::shouldReceive('installedPath')->andReturn($path); - $this->assertFileNotExists($modifier = "$path/src/Modifiers/Yoda.php"); + $this->assertFileDoesNotExist($modifier = "$path/src/Modifiers/Yoda.php"); $this->artisan('statamic:make:modifier', ['name' => 'Yoda', 'addon' => 'yoda/bag-odah']); diff --git a/tests/Console/Commands/MakeScopeTest.php b/tests/Console/Commands/MakeScopeTest.php index 222ccd7808a..943535947ce 100644 --- a/tests/Console/Commands/MakeScopeTest.php +++ b/tests/Console/Commands/MakeScopeTest.php @@ -31,7 +31,7 @@ public function it_can_make_a_scope() { $path = base_path('app/Scopes/Dog.php'); - $this->assertFileNotExists($path); + $this->assertFileDoesNotExist($path); $this->artisan('statamic:make:scope', ['name' => 'Dog']); @@ -44,7 +44,7 @@ public function it_will_not_overwrite_an_existing_scope() { $path = base_path('app/Scopes/Dog.php'); - $this->assertFileNotExists($path); + $this->assertFileDoesNotExist($path); $this->artisan('statamic:make:scope', ['name' => 'Dog']); $this->files->put($path, 'overwritten scope'); @@ -80,7 +80,7 @@ public function it_can_make_a_scope_into_an_addon() Composer::shouldReceive('installedPath')->andReturn($path); - $this->assertFileNotExists($scope = "$path/src/Scopes/Yoda.php"); + $this->assertFileDoesNotExist($scope = "$path/src/Scopes/Yoda.php"); $this->artisan('statamic:make:scope', ['name' => 'Yoda', 'addon' => 'yoda/bag-odah']); diff --git a/tests/Console/Commands/MakeTagTest.php b/tests/Console/Commands/MakeTagTest.php index 34c6fdab71a..3830c25bdcf 100644 --- a/tests/Console/Commands/MakeTagTest.php +++ b/tests/Console/Commands/MakeTagTest.php @@ -31,7 +31,7 @@ public function it_can_make_a_tag() { $path = base_path('app/Tags/Donkey.php'); - $this->assertFileNotExists($path); + $this->assertFileDoesNotExist($path); $this->artisan('statamic:make:tag', ['name' => 'Donkey']); @@ -44,7 +44,7 @@ public function it_will_not_overwrite_an_existing_tag() { $path = base_path('app/Tags/Donkey.php'); - $this->assertFileNotExists($path); + $this->assertFileDoesNotExist($path); $this->artisan('statamic:make:tag', ['name' => 'Donkey']); $this->files->put($path, 'overwritten tag'); @@ -80,7 +80,7 @@ public function it_can_make_a_tag_into_an_addon() Composer::shouldReceive('installedPath')->andReturn($path); - $this->assertFileNotExists($tag = "$path/src/Tags/Yoda.php"); + $this->assertFileDoesNotExist($tag = "$path/src/Tags/Yoda.php"); $this->artisan('statamic:make:tag', ['name' => 'Yoda', 'addon' => 'yoda/bag-odah']); diff --git a/tests/Console/Commands/MakeWidgetTest.php b/tests/Console/Commands/MakeWidgetTest.php index 486b571a443..18d1b126ca1 100644 --- a/tests/Console/Commands/MakeWidgetTest.php +++ b/tests/Console/Commands/MakeWidgetTest.php @@ -31,7 +31,7 @@ public function it_can_make_a_widget() { $path = base_path('app/Widgets/Sloth.php'); - $this->assertFileNotExists($path); + $this->assertFileDoesNotExist($path); $this->artisan('statamic:make:widget', ['name' => 'Sloth']); @@ -44,7 +44,7 @@ public function it_will_not_overwrite_an_existing_widget() { $path = base_path('app/Widgets/Sloth.php'); - $this->assertFileNotExists($path); + $this->assertFileDoesNotExist($path); $this->artisan('statamic:make:widget', ['name' => 'Sloth']); $this->files->put($path, 'overwritten widget'); @@ -80,7 +80,7 @@ public function it_can_make_a_widget_into_an_addon() Composer::shouldReceive('installedPath')->andReturn($path); - $this->assertFileNotExists($widget = "$path/src/Widgets/Yoda.php"); + $this->assertFileDoesNotExist($widget = "$path/src/Widgets/Yoda.php"); $this->artisan('statamic:make:widget', ['name' => 'Yoda', 'addon' => 'yoda/bag-odah']); diff --git a/tests/Filesystem/FilesystemAdapterTests.php b/tests/Filesystem/FilesystemAdapterTests.php index 6a98ffa5d38..5842b70b5b0 100644 --- a/tests/Filesystem/FilesystemAdapterTests.php +++ b/tests/Filesystem/FilesystemAdapterTests.php @@ -66,7 +66,7 @@ public function deletes_files() { file_put_contents($this->tempDir.'/filename.txt', 'Hello World'); $this->adapter->delete('filename.txt'); - $this->assertFileNotExists($this->tempDir.'/filename.txt'); + $this->assertFileDoesNotExist($this->tempDir.'/filename.txt'); } /** @test */ @@ -102,7 +102,7 @@ public function moves_files() file_put_contents($this->tempDir.'/src.txt', 'Hello World'); $this->assertTrue($this->adapter->move('src.txt', 'dest.txt')); $this->assertStringEqualsFile($this->tempDir.'/dest.txt', 'Hello World'); - $this->assertFileNotExists($this->tempDir.'/src.txt'); + $this->assertFileDoesNotExist($this->tempDir.'/src.txt'); } /** @test */ @@ -112,7 +112,7 @@ public function moves_files_and_overwrites() file_put_contents($this->tempDir.'/dest.txt', 'Existing Content'); $this->assertTrue($this->adapter->move('src.txt', 'dest.txt', true)); $this->assertStringEqualsFile($this->tempDir.'/dest.txt', 'Hello World'); - $this->assertFileNotExists($this->tempDir.'/src.txt'); + $this->assertFileDoesNotExist($this->tempDir.'/src.txt'); } /** @test */ @@ -120,7 +120,7 @@ public function renames_a_file() { file_put_contents($this->tempDir.'/src.txt', 'Hello World'); $this->assertTrue($this->adapter->rename('src.txt', 'dest.txt')); - $this->assertFileNotExists($this->tempDir.'/src.txt'); + $this->assertFileDoesNotExist($this->tempDir.'/src.txt'); $this->assertStringEqualsFile($this->tempDir.'/dest.txt', 'Hello World'); } @@ -354,8 +354,8 @@ public function moves_directories() $this->adapter->moveDirectory('src', 'dest'); - $this->assertFileNotExists($this->tempDir.'/src/one.txt'); - $this->assertFileNotExists($this->tempDir.'/src/two.txt'); + $this->assertFileDoesNotExist($this->tempDir.'/src/one.txt'); + $this->assertFileDoesNotExist($this->tempDir.'/src/two.txt'); $this->assertStringEqualsFile($this->tempDir.'/dest/one.txt', 'One'); $this->assertStringEqualsFile($this->tempDir.'/dest/two.txt', 'Two'); } diff --git a/tests/Imaging/GlideTest.php b/tests/Imaging/GlideTest.php index bdb8d4f6800..e4695b2f599 100644 --- a/tests/Imaging/GlideTest.php +++ b/tests/Imaging/GlideTest.php @@ -155,7 +155,7 @@ public function it_deletes_glide_cache_for_an_asset() Glide::clearAsset(Asset::find('test_container::foo/hoff.jpg')); - $this->assertFileNotExists($glidePath); + $this->assertFileDoesNotExist($glidePath); $cacheKeys->each(function ($cacheKey) { $this->assertFalse(Glide::cacheStore()->has($cacheKey)); diff --git a/tests/Preferences/DefaultPreferencesTest.php b/tests/Preferences/DefaultPreferencesTest.php index 101777f74f5..d0640256da7 100644 --- a/tests/Preferences/DefaultPreferencesTest.php +++ b/tests/Preferences/DefaultPreferencesTest.php @@ -29,7 +29,7 @@ public function tearDown(): void /** @test */ public function it_gets_empty_array_by_default() { - $this->assertFileNotExists(resource_path('preferences.yaml')); + $this->assertFileDoesNotExist(resource_path('preferences.yaml')); $this->assertEquals([], Preference::default()->all()); } @@ -88,7 +88,7 @@ public function it_removes_a_preference_by_key() /** @test */ public function it_saves_preferences_to_file() { - $this->assertFileNotExists(resource_path('preferences.yaml')); + $this->assertFileDoesNotExist(resource_path('preferences.yaml')); Preference::default()->set($preferences = [ 'collections' => [ @@ -110,7 +110,7 @@ public function it_saves_preferences_to_file() /** @test */ public function it_merges_preferences_to_file() { - $this->assertFileNotExists(resource_path('preferences.yaml')); + $this->assertFileDoesNotExist(resource_path('preferences.yaml')); Preference::default()->set($preferences = [ 'foo' => 'bar', diff --git a/tests/Stache/Repositories/EntryRepositoryTest.php b/tests/Stache/Repositories/EntryRepositoryTest.php index 35baad9967c..3a1a8597ef5 100644 --- a/tests/Stache/Repositories/EntryRepositoryTest.php +++ b/tests/Stache/Repositories/EntryRepositoryTest.php @@ -225,6 +225,6 @@ public function it_can_delete() $this->assertCount(14, $this->repo->all()); $this->assertNull($item = $this->repo->find('test-blog-entry')); - $this->assertFileNotExists($path); + $this->assertFileDoesNotExist($path); } } diff --git a/tests/Stache/Stores/EntriesStoreTest.php b/tests/Stache/Stores/EntriesStoreTest.php index 162fd42817e..fb963d8b317 100644 --- a/tests/Stache/Stores/EntriesStoreTest.php +++ b/tests/Stache/Stores/EntriesStoreTest.php @@ -176,7 +176,7 @@ public function it_saves_to_disk() $this->assertStringEqualsFile($path = $this->directory.'/blog/2017-07-04.test.md', $entry->fileContents()); @unlink($path); - $this->assertFileNotExists($path); + $this->assertFileDoesNotExist($path); $this->assertEquals($path, $this->parent->store('blog')->paths()->get('123')); } @@ -229,9 +229,9 @@ public function it_appends_suffix_to_the_filename_if_one_already_exists() @unlink($newPath); @unlink($anotherNewPath); @unlink($existingPath); - $this->assertFileNotExists($newPath); - $this->assertFileNotExists($anotherNewPath); - $this->assertFileNotExists($existingPath); + $this->assertFileDoesNotExist($newPath); + $this->assertFileDoesNotExist($anotherNewPath); + $this->assertFileDoesNotExist($existingPath); } /** @test */ @@ -253,8 +253,8 @@ public function it_doesnt_append_the_suffix_to_the_filename_if_it_is_itself() $this->assertEquals($existingPath, $this->parent->store('blog')->paths()->get('the-id')); @unlink($existingPath); - $this->assertFileNotExists($pathWithSuffix); - $this->assertFileNotExists($existingPath); + $this->assertFileDoesNotExist($pathWithSuffix); + $this->assertFileDoesNotExist($existingPath); } /** @test */ @@ -276,8 +276,8 @@ public function it_doesnt_append_the_suffix_to_an_already_suffixed_filename_if_i $pathWithIncrementedSuffix = $this->directory.'/blog/2017-07-04.test.2.md'; $this->assertStringEqualsFile($suffixedExistingPath, $entry->fileContents()); @unlink($suffixedExistingPath); - $this->assertFileNotExists($pathWithIncrementedSuffix); - $this->assertFileNotExists($suffixedExistingPath); + $this->assertFileDoesNotExist($pathWithIncrementedSuffix); + $this->assertFileDoesNotExist($suffixedExistingPath); $this->assertEquals($suffixedExistingPath, $this->parent->store('blog')->paths()->get('another-id')); } @@ -294,12 +294,12 @@ public function it_keeps_the_suffix_even_if_the_suffixless_path_is_available() $this->parent->store('blog')->save($entry); $this->assertStringEqualsFile($existingPath, $entry->fileContents()); - $this->assertFileNotExists($suffixlessPath); + $this->assertFileDoesNotExist($suffixlessPath); $this->assertEquals($existingPath, $this->parent->store('blog')->paths()->get('123')); @unlink($existingPath); - $this->assertFileNotExists($existingPath); + $this->assertFileDoesNotExist($existingPath); } /** @test */ @@ -319,12 +319,12 @@ public function it_removes_the_suffix_if_it_previously_had_one_but_needs_a_new_p $this->parent->store('blog')->save($entry); $this->assertStringEqualsFile($newPath, $entry->fileContents()); - $this->assertFileNotExists($existingPath); + $this->assertFileDoesNotExist($existingPath); $this->assertEquals($newPath, $this->parent->store('blog')->paths()->get('123')); @unlink($newPath); - $this->assertFileNotExists($newPath); + $this->assertFileDoesNotExist($newPath); } /** @test */ diff --git a/tests/Stache/Stores/TermsStoreTest.php b/tests/Stache/Stores/TermsStoreTest.php index 85b785cc761..34429538b92 100644 --- a/tests/Stache/Stores/TermsStoreTest.php +++ b/tests/Stache/Stores/TermsStoreTest.php @@ -39,7 +39,7 @@ public function it_saves_to_disk() $this->assertStringEqualsFile($path = $this->directory.'/tags/test.yaml', $term->fileContents()); @unlink($path); - $this->assertFileNotExists($path); + $this->assertFileDoesNotExist($path); $this->assertEquals($path, $this->parent->store('tags')->paths()->get('en::test')); } diff --git a/tests/StarterKits/ExportTest.php b/tests/StarterKits/ExportTest.php index 1e68231e114..07d8d221394 100644 --- a/tests/StarterKits/ExportTest.php +++ b/tests/StarterKits/ExportTest.php @@ -54,7 +54,7 @@ public function tearDown(): void /** @test */ public function it_can_stub_out_a_new_config() { - $this->assertFileNotExists($this->configPath); + $this->assertFileDoesNotExist($this->configPath); $this->exportCoolRunnings(); @@ -70,8 +70,8 @@ public function it_can_export_files() 'resources/views/welcome.blade.php', ]); - $this->assertFileNotExists($filesystemsConfig = $this->exportPath('config/filesystems.php')); - $this->assertFileNotExists($composerJson = $this->exportPath('resources/views/welcome.blade.php')); + $this->assertFileDoesNotExist($filesystemsConfig = $this->exportPath('config/filesystems.php')); + $this->assertFileDoesNotExist($composerJson = $this->exportPath('resources/views/welcome.blade.php')); $this->exportCoolRunnings(); @@ -90,8 +90,8 @@ public function it_can_export_folders() 'resources/views', ]); - $this->assertFileNotExists($this->exportPath('config')); - $this->assertFileNotExists($this->exportPath('resources/views')); + $this->assertFileDoesNotExist($this->exportPath('config')); + $this->assertFileDoesNotExist($this->exportPath('resources/views')); $this->exportCoolRunnings(); @@ -100,7 +100,7 @@ public function it_can_export_folders() $this->assertFileExists($this->exportPath('config/app.php')); $this->assertFileExists($this->exportPath('resources/views/errors')); - $this->assertFileNotExists($this->exportPath('resources/js')); + $this->assertFileDoesNotExist($this->exportPath('resources/js')); } /** @test */ @@ -124,10 +124,10 @@ public function it_can_export_as_to_different_destination_path() 'test-folder' => 'test-renamed-folder', ]); - $this->assertFileNotExists($filesystemsConfig = $this->exportPath('config/filesystems.php')); - $this->assertFileNotExists($composerJson = $this->exportPath('resources/views/errors')); - $this->assertFileNotExists($renamedFile = $this->exportPath('README-new-site.md')); - $this->assertFileNotExists($renamedFolder = $this->exportPath('test-renamed-folder')); + $this->assertFileDoesNotExist($filesystemsConfig = $this->exportPath('config/filesystems.php')); + $this->assertFileDoesNotExist($composerJson = $this->exportPath('resources/views/errors')); + $this->assertFileDoesNotExist($renamedFile = $this->exportPath('README-new-site.md')); + $this->assertFileDoesNotExist($renamedFolder = $this->exportPath('test-renamed-folder')); $this->exportCoolRunnings(); @@ -136,8 +136,8 @@ public function it_can_export_as_to_different_destination_path() $this->assertFileExists($renamedFile); $this->assertFileExists($renamedFolder); - $this->assertFileNotExists($this->exportPath('README.md')); // This got renamed above - $this->assertFileNotExists($this->exportPath('test-folder')); // This got renamed above + $this->assertFileDoesNotExist($this->exportPath('README.md')); // This got renamed above + $this->assertFileDoesNotExist($this->exportPath('test-folder')); // This got renamed above $this->assertFileHasContent('This is readme for the new site!', $renamedFile); $this->assertFileHasContent('One.', $renamedFolder.'/one.txt'); @@ -153,7 +153,7 @@ public function it_copies_export_config() 'config', ]); - $this->assertFileNotExists($starterKitConfig = $this->exportPath('starter-kit.yaml')); + $this->assertFileDoesNotExist($starterKitConfig = $this->exportPath('starter-kit.yaml')); $this->exportCoolRunnings(); @@ -168,7 +168,7 @@ public function it_copies_post_install_script_hook_when_available() 'config', ]); - $this->assertFileNotExists($postInstallHook = $this->exportPath('StarterKitPostInstall.php')); + $this->assertFileDoesNotExist($postInstallHook = $this->exportPath('StarterKitPostInstall.php')); $this->files->put(base_path('StarterKitPostInstall.php'), 'exportCoolRunnings(); - $this->assertFileNotExists($this->exportPath('composer.json')); + $this->assertFileDoesNotExist($this->exportPath('composer.json')); } /** @test */ @@ -448,7 +448,7 @@ public function it_does_not_export_as_with_opinionated_app_composer_json() $this->exportCoolRunnings(); - $this->assertFileNotExists($this->exportPath('composer.json')); + $this->assertFileDoesNotExist($this->exportPath('composer.json')); } /** @test */ diff --git a/tests/StarterKits/InstallTest.php b/tests/StarterKits/InstallTest.php index 8229a9bb19e..b5c40864b4f 100644 --- a/tests/StarterKits/InstallTest.php +++ b/tests/StarterKits/InstallTest.php @@ -49,15 +49,15 @@ public function tearDown(): void /** @test */ public function it_installs_starter_kit() { - $this->assertFileNotExists($this->kitVendorPath()); + $this->assertFileDoesNotExist($this->kitVendorPath()); $this->assertComposerJsonDoesntHave('repositories'); - $this->assertFileNotExists(base_path('copied.md')); + $this->assertFileDoesNotExist(base_path('copied.md')); $this->installCoolRunnings(); $this->assertFalse(Blink::has('starter-kit-repository-added')); - $this->assertFileNotExists($this->kitVendorPath()); - $this->assertFileNotExists(base_path('composer.json.bak')); + $this->assertFileDoesNotExist($this->kitVendorPath()); + $this->assertFileDoesNotExist(base_path('composer.json.bak')); $this->assertComposerJsonDoesntHave('repositories'); $this->assertFileExists(base_path('copied.md')); } @@ -76,24 +76,24 @@ public function it_installs_from_custom_export_paths() ], ]); - $this->assertFileNotExists($this->kitVendorPath()); + $this->assertFileDoesNotExist($this->kitVendorPath()); $this->assertComposerJsonDoesntHave('repositories'); - $this->assertFileNotExists(base_path('copied.md')); - $this->assertFileNotExists($renamedFile = base_path('README.md')); - $this->assertFileNotExists($renamedFolder = base_path('original-dir')); + $this->assertFileDoesNotExist(base_path('copied.md')); + $this->assertFileDoesNotExist($renamedFile = base_path('README.md')); + $this->assertFileDoesNotExist($renamedFolder = base_path('original-dir')); $this->installCoolRunnings(); $this->assertFalse(Blink::has('starter-kit-repository-added')); - $this->assertFileNotExists($this->kitVendorPath()); - $this->assertFileNotExists(base_path('composer.json.bak')); + $this->assertFileDoesNotExist($this->kitVendorPath()); + $this->assertFileDoesNotExist(base_path('composer.json.bak')); $this->assertComposerJsonDoesntHave('repositories'); $this->assertFileExists(base_path('copied.md')); $this->assertFileExists($renamedFile); $this->assertFileExists($renamedFolder); - $this->assertFileNotExists(base_path('README-for-new-site.md')); // This was renamed back to original path on install - $this->assertFileNotExists(base_path('renamed-dir')); // This was renamed back to original path on install + $this->assertFileDoesNotExist(base_path('README-for-new-site.md')); // This was renamed back to original path on install + $this->assertFileDoesNotExist(base_path('renamed-dir')); // This was renamed back to original path on install $this->assertFileHasContent('This readme should get installed to README.md.', $renamedFile); $this->assertFileHasContent('One.', $renamedFolder.'/one.txt'); @@ -103,9 +103,9 @@ public function it_installs_from_custom_export_paths() /** @test */ public function it_installs_from_github() { - $this->assertFileNotExists($this->kitVendorPath()); + $this->assertFileDoesNotExist($this->kitVendorPath()); $this->assertComposerJsonDoesntHave('repositories'); - $this->assertFileNotExists(base_path('copied.md')); + $this->assertFileDoesNotExist(base_path('copied.md')); $this->installCoolRunnings([], [ 'outpost.*' => Http::response(['data' => ['price' => null]], 200), @@ -114,7 +114,7 @@ public function it_installs_from_github() ]); $this->assertEquals('https://github.com/statamic/cool-runnings', Blink::get('starter-kit-repository-added')); - $this->assertFileNotExists($this->kitVendorPath()); + $this->assertFileDoesNotExist($this->kitVendorPath()); $this->assertComposerJsonDoesntHave('repositories'); $this->assertFileExists(base_path('copied.md')); } @@ -122,9 +122,9 @@ public function it_installs_from_github() /** @test */ public function it_installs_from_bitbucket() { - $this->assertFileNotExists($this->kitVendorPath()); + $this->assertFileDoesNotExist($this->kitVendorPath()); $this->assertComposerJsonDoesntHave('repositories'); - $this->assertFileNotExists(base_path('copied.md')); + $this->assertFileDoesNotExist(base_path('copied.md')); $this->installCoolRunnings([], [ 'outpost.*' => Http::response(['data' => ['price' => null]], 200), @@ -133,7 +133,7 @@ public function it_installs_from_bitbucket() ]); $this->assertEquals('https://bitbucket.org/statamic/cool-runnings.git', Blink::get('starter-kit-repository-added')); - $this->assertFileNotExists($this->kitVendorPath()); + $this->assertFileDoesNotExist($this->kitVendorPath()); $this->assertComposerJsonDoesntHave('repositories'); $this->assertFileExists(base_path('copied.md')); } @@ -141,9 +141,9 @@ public function it_installs_from_bitbucket() /** @test */ public function it_installs_from_gitlab() { - $this->assertFileNotExists($this->kitVendorPath()); + $this->assertFileDoesNotExist($this->kitVendorPath()); $this->assertComposerJsonDoesntHave('repositories'); - $this->assertFileNotExists(base_path('copied.md')); + $this->assertFileDoesNotExist(base_path('copied.md')); $this->installCoolRunnings([], [ 'outpost.*' => Http::response(['data' => ['price' => null]], 200), @@ -152,7 +152,7 @@ public function it_installs_from_gitlab() ]); $this->assertEquals('https://gitlab.com/statamic/cool-runnings', Blink::get('starter-kit-repository-added')); - $this->assertFileNotExists($this->kitVendorPath()); + $this->assertFileDoesNotExist($this->kitVendorPath()); $this->assertComposerJsonDoesntHave('repositories'); $this->assertFileExists(base_path('copied.md')); } @@ -174,8 +174,8 @@ public function it_installs_successfully_without_pinging_cloud_when_local_option /** @test */ public function it_restores_existing_repositories_after_successful_install() { - $this->assertFileNotExists($this->kitVendorPath()); - $this->assertFileNotExists(base_path('copied.md')); + $this->assertFileDoesNotExist($this->kitVendorPath()); + $this->assertFileDoesNotExist(base_path('copied.md')); $composerJson = json_decode($this->files->get(base_path('composer.json')), true); @@ -202,7 +202,7 @@ public function it_restores_existing_repositories_after_successful_install() ]); $this->assertEquals('https://github.com/statamic/cool-runnings', Blink::get('starter-kit-repository-added')); - $this->assertFileNotExists($this->kitVendorPath()); + $this->assertFileDoesNotExist($this->kitVendorPath()); $this->assertFileExists(base_path('copied.md')); $composerJson = json_decode($this->files->get(base_path('composer.json')), true); @@ -218,7 +218,7 @@ public function it_fails_if_starter_kit_config_does_not_exist() $this->installCoolRunnings(); - $this->assertFileNotExists(base_path('copied.md')); + $this->assertFileDoesNotExist(base_path('copied.md')); } /** @test */ @@ -233,7 +233,7 @@ public function it_fails_if_an_export_path_doesnt_exist() $this->installCoolRunnings(); - $this->assertFileNotExists(base_path('copied.md')); + $this->assertFileDoesNotExist(base_path('copied.md')); } /** @test */ @@ -242,7 +242,7 @@ public function it_merges_folders() $this->files->put($this->preparePath(base_path('content/collections/pages/contact.md')), 'Contact'); $this->assertFileExists(base_path('content/collections/pages/contact.md')); - $this->assertFileNotExists(base_path('content/collections/pages/home.md')); + $this->assertFileDoesNotExist(base_path('content/collections/pages/home.md')); $this->installCoolRunnings(); @@ -253,13 +253,13 @@ public function it_merges_folders() /** @test */ public function it_doesnt_copy_files_not_defined_as_export_paths() { - $this->assertFileNotExists(base_path('copied.md')); - $this->assertFileNotExists(base_path('not-copied.md')); + $this->assertFileDoesNotExist(base_path('copied.md')); + $this->assertFileDoesNotExist(base_path('not-copied.md')); $this->installCoolRunnings(); $this->assertFileExists(base_path('copied.md')); - $this->assertFileNotExists(base_path('not-copied.md')); + $this->assertFileDoesNotExist(base_path('not-copied.md')); } /** @test */ @@ -278,7 +278,7 @@ public function it_doesnt_copy_starter_kit_config_by_default() { $this->installCoolRunnings(); - $this->assertFileNotExists(base_path('starter-kit.yaml')); + $this->assertFileDoesNotExist(base_path('starter-kit.yaml')); } /** @test */ @@ -327,7 +327,7 @@ public function it_doesnt_copy_starter_kit_post_install_script_hook_when_with_co $this->installCoolRunnings(); - $this->assertFileNotExists(base_path('StarterKitPostInstall.php')); + $this->assertFileDoesNotExist(base_path('StarterKitPostInstall.php')); } /** @test */ @@ -370,8 +370,8 @@ public function it_clears_site_when_option_is_passed() $this->installCoolRunnings(['--clear-site' => true]); $this->assertFileExists(base_path('content/collections/pages/home.md')); - $this->assertFileNotExists(base_path('content/collections/pages/contact.md')); - $this->assertFileNotExists(base_path('content/collections/blog')); + $this->assertFileDoesNotExist(base_path('content/collections/pages/contact.md')); + $this->assertFileDoesNotExist(base_path('content/collections/blog')); } /** @test */ @@ -387,16 +387,16 @@ public function it_installs_dependencies() ], ]); - $this->assertFileNotExists(base_path('vendor/statamic/cool-runnings')); - $this->assertFileNotExists(base_path('vendor/statamic/seo-pro')); + $this->assertFileDoesNotExist(base_path('vendor/statamic/cool-runnings')); + $this->assertFileDoesNotExist(base_path('vendor/statamic/seo-pro')); $this->assertComposerJsonDoesntHave('statamic/seo-pro'); - $this->assertFileNotExists(base_path('vendor/bobsled/speed-calculator')); + $this->assertFileDoesNotExist(base_path('vendor/bobsled/speed-calculator')); $this->assertComposerJsonDoesntHave('bobsled/speed-calculator'); $this->installCoolRunnings(); $this->assertComposerJsonDoesntHave('repositories'); - $this->assertFileNotExists(base_path('vendor/statamic/cool-runnings')); + $this->assertFileDoesNotExist(base_path('vendor/statamic/cool-runnings')); $this->assertFileExists(base_path('vendor/statamic/seo-pro')); $this->assertComposerJsonHasPackageVersion('require', 'statamic/seo-pro', '^0.2.0'); $this->assertFileExists(base_path('vendor/bobsled/speed-calculator')); @@ -415,14 +415,14 @@ public function it_installs_dev_dependencies() ], ]); - $this->assertFileNotExists(base_path('vendor/statamic/cool-runnings')); - $this->assertFileNotExists(base_path('vendor/statamic/ssg')); + $this->assertFileDoesNotExist(base_path('vendor/statamic/cool-runnings')); + $this->assertFileDoesNotExist(base_path('vendor/statamic/ssg')); $this->assertComposerJsonDoesntHave('statamic/ssg'); $this->installCoolRunnings(); $this->assertComposerJsonDoesntHave('repositories'); - $this->assertFileNotExists(base_path('vendor/statamic/cool-runnings')); + $this->assertFileDoesNotExist(base_path('vendor/statamic/cool-runnings')); $this->assertFileExists(base_path('vendor/statamic/ssg')); $this->assertComposerJsonHasPackageVersion('require-dev', 'statamic/ssg', '*'); } @@ -443,18 +443,18 @@ public function it_installs_both_types_of_dependencies() ], ]); - $this->assertFileNotExists(base_path('vendor/statamic/cool-runnings')); - $this->assertFileNotExists(base_path('vendor/statamic/seo-pro')); + $this->assertFileDoesNotExist(base_path('vendor/statamic/cool-runnings')); + $this->assertFileDoesNotExist(base_path('vendor/statamic/seo-pro')); $this->assertComposerJsonDoesntHave('statamic/seo-pro'); - $this->assertFileNotExists(base_path('vendor/bobsled/speed-calculator')); + $this->assertFileDoesNotExist(base_path('vendor/bobsled/speed-calculator')); $this->assertComposerJsonDoesntHave('bobsled/speed-calculator'); - $this->assertFileNotExists(base_path('vendor/statamic/ssg')); + $this->assertFileDoesNotExist(base_path('vendor/statamic/ssg')); $this->assertComposerJsonDoesntHave('statamic/ssg'); $this->installCoolRunnings(); $this->assertComposerJsonDoesntHave('repositories'); - $this->assertFileNotExists(base_path('vendor/statamic/cool-runnings')); + $this->assertFileDoesNotExist(base_path('vendor/statamic/cool-runnings')); $this->assertFileExists(base_path('vendor/statamic/seo-pro')); $this->assertComposerJsonHasPackageVersion('require', 'statamic/seo-pro', '^0.2.0'); $this->assertFileExists(base_path('vendor/bobsled/speed-calculator')); @@ -537,9 +537,9 @@ public function it_installs_paid_starter_kit_with_valid_license_key() { Config::set('statamic.system.license_key', 'site-key'); - $this->assertFileNotExists($this->kitVendorPath()); + $this->assertFileDoesNotExist($this->kitVendorPath()); $this->assertComposerJsonDoesntHave('repositories'); - $this->assertFileNotExists(base_path('copied.md')); + $this->assertFileDoesNotExist(base_path('copied.md')); $this->installCoolRunnings([], [ 'outpost.*/v3/starter-kits/statamic/cool-runnings' => Http::response(['data' => [ @@ -554,8 +554,8 @@ public function it_installs_paid_starter_kit_with_valid_license_key() ]); $this->assertFalse(Blink::has('starter-kit-repository-added')); - $this->assertFileNotExists($this->kitVendorPath()); - $this->assertFileNotExists(base_path('composer.json.bak')); + $this->assertFileDoesNotExist($this->kitVendorPath()); + $this->assertFileDoesNotExist(base_path('composer.json.bak')); $this->assertComposerJsonDoesntHave('repositories'); $this->assertFileExists(base_path('copied.md')); } @@ -565,9 +565,9 @@ public function it_doesnt_install_paid_starter_kit_with_invalid_license_key() { Config::set('statamic.system.license_key', 'site-key'); - $this->assertFileNotExists($this->kitVendorPath()); + $this->assertFileDoesNotExist($this->kitVendorPath()); $this->assertComposerJsonDoesntHave('repositories'); - $this->assertFileNotExists(base_path('copied.md')); + $this->assertFileDoesNotExist(base_path('copied.md')); $this->installCoolRunnings([], [ 'outpost.*/v3/starter-kits/statamic/cool-runnings' => Http::response(['data' => [ @@ -582,10 +582,10 @@ public function it_doesnt_install_paid_starter_kit_with_invalid_license_key() ]); $this->assertFalse(Blink::has('starter-kit-repository-added')); - $this->assertFileNotExists($this->kitVendorPath()); - $this->assertFileNotExists(base_path('composer.json.bak')); + $this->assertFileDoesNotExist($this->kitVendorPath()); + $this->assertFileDoesNotExist(base_path('composer.json.bak')); $this->assertComposerJsonDoesntHave('repositories'); - $this->assertFileNotExists(base_path('copied.md')); + $this->assertFileDoesNotExist(base_path('copied.md')); } /** @test */ @@ -659,8 +659,8 @@ public function it_doesnt_caches_post_install_hook_instructions_when_not_being_r $this->installCoolRunnings(['--cli-install' => false]); - $this->assertFileNotExists(storage_path('statamic/tmp/cli/post-install-instructions.txt')); - $this->assertFileNotExists(base_path('vendor/statamic/cool-runnings')); + $this->assertFileDoesNotExist(storage_path('statamic/tmp/cli/post-install-instructions.txt')); + $this->assertFileDoesNotExist(base_path('vendor/statamic/cool-runnings')); } private function kitRepoPath($path = null) diff --git a/tests/StarterKits/RunPostInstallTest.php b/tests/StarterKits/RunPostInstallTest.php index 1a3926200b2..3efcff0daed 100644 --- a/tests/StarterKits/RunPostInstallTest.php +++ b/tests/StarterKits/RunPostInstallTest.php @@ -40,14 +40,14 @@ public function tearDown(): void /** @test */ public function it_runs_post_install_hook_script() { - $this->assertFileNotExists($this->kitVendorPath()); - $this->assertFileNotExists(base_path('copied.md')); + $this->assertFileDoesNotExist($this->kitVendorPath()); + $this->assertFileDoesNotExist(base_path('copied.md')); $this->simulateCliInstallWithoutTtySupport(); // Ensure starter kit itself was installed, but not yet cleaned up because a manual post-install is required $this->assertFileExists(base_path('copied.md')); - $this->assertFileNotExists(base_path('composer.json.bak')); + $this->assertFileDoesNotExist(base_path('composer.json.bak')); $this->assertFileExists(base_path('composer.json')); $this->assertComposerJsonDoesntHave('repositories'); $this->assertFileExists($this->kitVendorPath()); @@ -62,7 +62,7 @@ public function it_runs_post_install_hook_script() // Now we should see that the hook has been run, and the starter kit has been cleaned up from vendor $this->assertTrue(Blink::has('post-install-hook-run')); - $this->assertFileNotExists($this->kitVendorPath()); + $this->assertFileDoesNotExist($this->kitVendorPath()); } /** @test */ diff --git a/tests/TestCase.php b/tests/TestCase.php index f3ede4505ad..6f22b4b719f 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -185,16 +185,6 @@ public function partialMock($abstract, \Closure $mock = null) return $mock; } - /** - * @deprecated - */ - public static function assertFileNotExists(string $filename, string $message = ''): void - { - method_exists(static::class, 'assertFileDoesNotExist') - ? static::assertFileDoesNotExist($filename, $message) - : parent::assertFileNotExists($filename, $message); - } - /** * @deprecated */ diff --git a/tests/UpdateScripts/UpdateScriptTest.php b/tests/UpdateScripts/UpdateScriptTest.php index 0c8fb51ca00..5cd14e45553 100644 --- a/tests/UpdateScripts/UpdateScriptTest.php +++ b/tests/UpdateScripts/UpdateScriptTest.php @@ -206,7 +206,7 @@ public function it_deletes_previous_lock_file_after_running_update_scripts() Manager::runAll(); - $this->assertFileNotExists($this->previousLockPath); + $this->assertFileDoesNotExist($this->previousLockPath); } /** @test */ @@ -313,7 +313,7 @@ public function it_runs_scripts_forspecific_package_versions() 'statamic/seo-pro' => '2.1.0', ], $this->lockPath); - $this->assertFileNotExists($this->previousLockPath); + $this->assertFileDoesNotExist($this->previousLockPath); $this->register(UpdateTaxonomies::class); $this->register(SeoProUpdate::class, 'statamic/seo-pro'); @@ -328,7 +328,7 @@ public function it_runs_scripts_forspecific_package_versions() $this->assertTrue(cache()->has('taxonomies-update-successful')); $this->assertFalse(cache()->has('seo-pro-update-successful')); - $this->assertFileNotExists($this->previousLockPath); + $this->assertFileDoesNotExist($this->previousLockPath); cache()->forget('taxonomies-update-successful'); @@ -336,7 +336,7 @@ public function it_runs_scripts_forspecific_package_versions() $this->assertFalse(cache()->has('taxonomies-update-successful')); $this->assertTrue(cache()->has('seo-pro-update-successful')); - $this->assertFileNotExists($this->previousLockPath); + $this->assertFileDoesNotExist($this->previousLockPath); } private function register($class, $package = 'statamic/cms') From b97d77a166f21d57014775aaf1b39d079dd09ad9 Mon Sep 17 00:00:00 2001 From: Jason Varga Date: Mon, 13 Feb 2023 18:00:48 -0500 Subject: [PATCH 17/19] replace assertDirectoryNotExists with assertDirectoryDoesNotExist --- tests/Filesystem/FilesystemAdapterTests.php | 6 +++--- tests/TestCase.php | 10 ---------- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/tests/Filesystem/FilesystemAdapterTests.php b/tests/Filesystem/FilesystemAdapterTests.php index 5842b70b5b0..9119302d7d4 100644 --- a/tests/Filesystem/FilesystemAdapterTests.php +++ b/tests/Filesystem/FilesystemAdapterTests.php @@ -374,9 +374,9 @@ public function deletes_empty_subdirectories() $this->assertDirectoryExists($this->tempDir.'/one'); $this->assertDirectoryExists($this->tempDir.'/one/two'); $this->assertDirectoryExists($this->tempDir.'/three'); - $this->assertDirectoryNotExists($this->tempDir.'/three/four'); - $this->assertDirectoryNotExists($this->tempDir.'/three/five'); - $this->assertDirectoryNotExists($this->tempDir.'/three/five/six'); + $this->assertDirectoryDoesNotExist($this->tempDir.'/three/four'); + $this->assertDirectoryDoesNotExist($this->tempDir.'/three/five'); + $this->assertDirectoryDoesNotExist($this->tempDir.'/three/five/six'); } /** @test */ diff --git a/tests/TestCase.php b/tests/TestCase.php index 6f22b4b719f..36fa95d45da 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -185,16 +185,6 @@ public function partialMock($abstract, \Closure $mock = null) return $mock; } - /** - * @deprecated - */ - public static function assertDirectoryNotExists(string $filename, string $message = ''): void - { - method_exists(static::class, 'assertDirectoryDoesNotExist') - ? static::assertDirectoryDoesNotExist($filename, $message) - : parent::assertDirectoryNotExists($filename, $message); - } - public static function assertMatchesRegularExpression(string $pattern, string $string, string $message = ''): void { method_exists(\PHPUnit\Framework\Assert::class, 'assertMatchesRegularExpression') From 55ac1599f0035fe9345f5c71d90ff9679588b1b0 Mon Sep 17 00:00:00 2001 From: Jason Varga Date: Mon, 13 Feb 2023 18:03:52 -0500 Subject: [PATCH 18/19] remove assertMatchesRegularExpression --- tests/TestCase.php | 7 ------- 1 file changed, 7 deletions(-) diff --git a/tests/TestCase.php b/tests/TestCase.php index 36fa95d45da..1de2e6c3ef5 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -185,13 +185,6 @@ public function partialMock($abstract, \Closure $mock = null) return $mock; } - public static function assertMatchesRegularExpression(string $pattern, string $string, string $message = ''): void - { - method_exists(\PHPUnit\Framework\Assert::class, 'assertMatchesRegularExpression') - ? parent::assertMatchesRegularExpression($pattern, $string, $message) - : parent::assertRegExp($pattern, $string, $message); - } - private function addGqlMacros() { $testResponseClass = version_compare($this->app->version(), 7, '<') From 89783657f7b8afc69109a15a1c26466a5aad070c Mon Sep 17 00:00:00 2001 From: Jason Varga Date: Mon, 13 Feb 2023 18:08:08 -0500 Subject: [PATCH 19/19] remove default_cache_length static cache config --- src/StaticCaching/Cachers/AbstractCacher.php | 3 +-- tests/StaticCaching/CacherTest.php | 21 -------------------- 2 files changed, 1 insertion(+), 23 deletions(-) diff --git a/src/StaticCaching/Cachers/AbstractCacher.php b/src/StaticCaching/Cachers/AbstractCacher.php index c8c4e9bfed2..c6999765bdb 100644 --- a/src/StaticCaching/Cachers/AbstractCacher.php +++ b/src/StaticCaching/Cachers/AbstractCacher.php @@ -68,8 +68,7 @@ public function getBaseUrl() */ public function getDefaultExpiration() { - return $this->config('expiry') - ?? $this->config('default_cache_length'); // deprecated + return $this->config('expiry'); } /** diff --git a/tests/StaticCaching/CacherTest.php b/tests/StaticCaching/CacherTest.php index 691bec3fb44..56f915481a2 100644 --- a/tests/StaticCaching/CacherTest.php +++ b/tests/StaticCaching/CacherTest.php @@ -33,27 +33,6 @@ public function gets_default_expiration() $this->assertEquals(10, $cacher->getDefaultExpiration()); } - /** @test */ - public function gets_default_expiration_using_deprecated_key() - { - $cacher = $this->cacher([ - 'default_cache_length' => 10, - ]); - - $this->assertEquals(10, $cacher->getDefaultExpiration()); - } - - /** @test */ - public function gets_default_expiration_where_new_key_takes_precedence_over_deprecated_key() - { - $cacher = $this->cacher([ - 'expiry' => 2, - 'default_cache_length' => 10, - ]); - - $this->assertEquals(2, $cacher->getDefaultExpiration()); - } - /** @test */ public function gets_a_url() {