From 6f56941cab728f80bf1f7334fc9af9b25d2b3fc5 Mon Sep 17 00:00:00 2001 From: Sean Fisher Date: Fri, 17 Nov 2023 15:53:43 -0500 Subject: [PATCH 01/26] Changes to support PHPunit 10 --- phpunit.xml | 2 +- src/mantle/testing/class-assert.php | 54 ------ tests/{test-faker.php => FakerTest.php} | 2 +- ...t-asset-loader.php => AssetLoaderTest.php} | 2 +- ...asset-manager.php => AssetManagerTest.php} | 2 +- .../{class-test-case.php => TestCase.php} | 2 +- tests/bootstrap.php | 2 + ...cache-manager.php => CacheManagerTest.php} | 2 +- ...test-repository.php => RepositoryTest.php} | 2 +- .../{test-command.php => CommandTest.php} | 2 +- ...r-command.php => GeneratorCommandTest.php} | 2 +- ...mmand.php => HookUsageCommandTest.php.bak} | 2 +- .../{test-parser.php => ParserTest.php} | 2 +- .../{test-printer.php => PrinterTest.php} | 2 +- ...ntainer-call.php => ContainerCallTest.php} | 4 +- .../{test-container.php => ContainerTest.php} | 4 +- .../{test-factory.php => FactoryTest.php} | 2 +- ...factory.php => UnitTestingFactoryTest.php} | 2 +- ...test-attachment.php => AttachmentTest.php} | 2 +- ...mment-object.php => CommentObjectTest.php} | 2 +- ...est-model-scope.php => ModelScopeTest.php} | 2 +- .../model/{test-model.php => ModelTest.php} | 2 +- ...nerator.php => PermalinkGeneratorTest.php} | 2 +- ...del-events.php => PostModelEventsTest.php} | 2 +- ...est-post-object.php => PostObjectTest.php} | 2 +- ...{test-rest-field.php => RestFieldTest.php} | 2 +- ...est-site-object.php => SiteObjectTest.php} | 2 +- ...del-events.php => TermModelEventsTest.php} | 2 +- ...est-term-object.php => TermObjectTest.php} | 2 +- ...est-user-object.php => UserObjectTest.php} | 2 +- ...register-meta.php => RegisterMetaTest.php} | 2 +- ...post-type.php => RegisterPostTypeTest.php} | 2 +- ...-taxonomy.php => RegisterTaxonomyTest.php} | 2 +- ...or-many.php => BelongsToOneOrManyTest.php} | 2 +- ...s-one-or-many.php => HasOneOrManyTest.php} | 2 +- ...ips.php => EagerLoadRelationshipsTest.php} | 2 +- .../{test-paginator.php => PaginatorTest.php} | 2 +- ...y-builder.php => PostQueryBuilderTest.php} | 2 +- ...ips.php => PostQueryRelationshipsTest.php} | 2 +- ...y-builder.php => TermQueryBuilderTest.php} | 2 +- ...dispatcher.php => EventDispatcherTest.php} | 2 +- ....php => WordPressActionDispatcherTest.php} | 2 +- ...-adapter.php => FilesystemAdapterTest.php} | 6 +- ...-manager.php => FilesystemManagerTest.php} | 2 +- ...test-filesystem.php => FilesystemTest.php} | 168 +++++++++--------- ...t-alias-loader.php => AliasLoaderTest.php} | 2 +- ...st-application.php => ApplicationTest.php} | 2 +- ...test-bootloader.php => BootloaderTest.php} | 2 +- ...ramework.php => IsolatedFrameworkTest.php} | 2 +- .../{test-pipeline.php => PipelineTest.php} | 2 +- ...ock-provider.php => BlockProviderTest.php} | 2 +- ...over-events.php => DiscoverEventsTest.php} | 2 +- ...=> NullableCommentObjectsTestCaseTest.php} | 2 +- ...hp => NullablePostObjectsTestCaseTest.php} | 2 +- .../NullableSiteObjectsTestCaseTest.php | 46 +++++ ...hp => NullableTermObjectsTestCaseTest.php} | 2 +- ...hp => NullableUserObjectsTestCaseTest.php} | 2 +- .../test-nullable-site-objects-test-case.php | 40 ----- ...helpers-array.php => HelpersArrayTest.php} | 2 +- ...ers-general.php => HelpersGeneralTest.php} | 4 +- .../{test-helpers.php => HelpersTest.php} | 2 +- ...est-http-client.php => HttpClientTest.php} | 2 +- ...test-controller.php => ControllerTest.php} | 2 +- ...test-redirector.php => RedirectorTest.php} | 2 +- ...se-factory.php => ResponseFactoryTest.php} | 2 +- .../http/{test-router.php => RouterTest.php} | 2 +- ...uploaded-file.php => UploadedFileTest.php} | 2 +- ...url-generator.php => UrlGeneratorTest.php} | 2 +- ...l-routing.php => PostModelRoutingTest.php} | 2 +- ...api-routing.php => RestApiRoutingTest.php} | 2 +- ...l-routing.php => TermModelRoutingTest.php} | 2 +- ...est-log-manager.php => LogManagerTest.php} | 2 +- ...test-dispatcher.php => DispatcherTest.php} | 2 +- ...queue-manager.php => QueueManagerTest.php} | 2 +- .../queue/{test-worker.php => WorkerTest.php} | 2 +- ...n-queue.php => WordPressCronQueueTest.php} | 2 +- .../{test-event.php => EventTest.php} | 2 +- .../{test-frequency.php => FrequencyTest.php} | 2 +- tests/support/{test-arr.php => ArrTest.php} | 2 +- ...test-collection.php => CollectionTest.php} | 4 +- ...st-environment.php => EnvironmentTest.php} | 2 +- ...forward-calls.php => ForwardCallsTest.php} | 2 +- ...test-pluralizer.php => PluralizerTest.php} | 2 +- ...e-provider.php => ServiceProviderTest.php} | 2 +- tests/support/{test-str.php => StrTest.php} | 2 +- ...test-stringable.php => StringableTest.php} | 2 +- ...ider.php => ModelRegisterProviderTest.php} | 2 +- ...ore-test-shim.php => CoreTestShimTest.php} | 2 +- ...ructure.php => PermalinkStructureTest.php} | 2 +- ...{test-with-faker.php => WithFakerTest.php} | 3 +- ...assertions.php => BlockAssertionsTest.php} | 2 +- ...-deprecations.php => DeprecationsTest.php} | 2 +- ...sertions.php => ElementAssertionsTest.php} | 2 +- ...rrect-usage.php => IncorrectUsageTest.php} | 2 +- ...nsole.php => InteractsWithConsoleTest.php} | 2 +- ... => InteractsWithExternalRequestsTest.php} | 2 +- ...h-hooks.php => InteractsWithHooksTest.php} | 2 +- ...requests.php => MakesHttpRequestsTest.php} | 2 +- ...on.php => WordPressAuthenticationTest.php} | 2 +- ...tpRequestsTest__test_match_snapshot__1.yml | 3 + ...estsTest__test_match_snapshot_http__1.html | 1 + ...__test_match_snapshot_http_partial__1.html | 6 + ...estsTest__test_match_snapshot_rest__1.json | 3 + ...estsTest__test_match_snapshot_rest__2.json | 3 + ...estsTest__test_match_snapshot_rest__3.json | 26 +++ ...equestsTest__test_multiple_requests__1.yml | 3 + ...ss.php => TestkitInstallWordPressTest.php} | 2 +- ...-test-case.php => TestkitTestCaseTest.php} | 6 +- ...{test-with-faker.php => WithFakerTest.php} | 2 +- ...ample-overload.php => ExampleOverload.php} | 4 +- ...est-blade-views.php => BladeViewsTest.php} | 2 +- ...est-file-engine.php => FileEngineTest.php} | 2 +- .../{test-php-views.php => PhpViewsTest.php} | 2 +- ...est-view-finder.php => ViewFinderTest.php} | 2 +- 114 files changed, 289 insertions(+), 289 deletions(-) delete mode 100644 src/mantle/testing/class-assert.php rename tests/{test-faker.php => FakerTest.php} (96%) rename tests/assets/{test-asset-loader.php => AssetLoaderTest.php} (98%) rename tests/assets/{test-asset-manager.php => AssetManagerTest.php} (98%) rename tests/assets/{class-test-case.php => TestCase.php} (97%) rename tests/cache/{test-cache-manager.php => CacheManagerTest.php} (97%) rename tests/config/{test-repository.php => RepositoryTest.php} (97%) rename tests/console/{test-command.php => CommandTest.php} (98%) rename tests/console/{test-generator-command.php => GeneratorCommandTest.php} (98%) rename tests/console/{test-hook-usage-command.php => HookUsageCommandTest.php.bak} (96%) rename tests/console/{test-parser.php => ParserTest.php} (99%) rename tests/console/generators/{test-printer.php => PrinterTest.php} (98%) rename tests/container/{test-container-call.php => ContainerCallTest.php} (99%) rename tests/container/{test-container.php => ContainerTest.php} (99%) rename tests/database/factory/{test-factory.php => FactoryTest.php} (99%) rename tests/database/factory/{test-unit-testing-factory.php => UnitTestingFactoryTest.php} (99%) rename tests/database/model/{test-attachment.php => AttachmentTest.php} (93%) rename tests/database/model/{test-comment-object.php => CommentObjectTest.php} (97%) rename tests/database/model/{test-model-scope.php => ModelScopeTest.php} (98%) rename tests/database/model/{test-model.php => ModelTest.php} (99%) rename tests/database/model/{test-permalink-generator.php => PermalinkGeneratorTest.php} (94%) rename tests/database/model/{test-post-model-events.php => PostModelEventsTest.php} (98%) rename tests/database/model/{test-post-object.php => PostObjectTest.php} (99%) rename tests/database/model/{test-rest-field.php => RestFieldTest.php} (93%) rename tests/database/model/{test-site-object.php => SiteObjectTest.php} (94%) rename tests/database/model/{test-term-model-events.php => TermModelEventsTest.php} (98%) rename tests/database/model/{test-term-object.php => TermObjectTest.php} (98%) rename tests/database/model/{test-user-object.php => UserObjectTest.php} (97%) rename tests/database/model/registration/{test-register-meta.php => RegisterMetaTest.php} (95%) rename tests/database/model/registration/{test-register-post-type.php => RegisterPostTypeTest.php} (98%) rename tests/database/model/registration/{test-register-taxonomy.php => RegisterTaxonomyTest.php} (96%) rename tests/database/model/relations/{test-belongs-to-one-or-many.php => BelongsToOneOrManyTest.php} (98%) rename tests/database/model/relations/{test-has-one-or-many.php => HasOneOrManyTest.php} (99%) rename tests/database/query/{test-eager-load-relationships.php => EagerLoadRelationshipsTest.php} (99%) rename tests/database/query/{test-paginator.php => PaginatorTest.php} (99%) rename tests/database/query/{test-post-query-builder.php => PostQueryBuilderTest.php} (99%) rename tests/database/query/{test-post-query-relationships.php => PostQueryRelationshipsTest.php} (97%) rename tests/database/query/{test-term-query-builder.php => TermQueryBuilderTest.php} (98%) rename tests/events/{test-event-dispatcher.php => EventDispatcherTest.php} (97%) rename tests/events/{test-wordpress-action-dispatcher.php => WordPressActionDispatcherTest.php} (98%) rename tests/filesystem/{test-filesystem-adapter.php => FilesystemAdapterTest.php} (98%) rename tests/filesystem/{test-filesystem-manager.php => FilesystemManagerTest.php} (97%) rename tests/filesystem/{test-filesystem.php => FilesystemTest.php} (67%) rename tests/framework/{test-alias-loader.php => AliasLoaderTest.php} (97%) rename tests/framework/{test-application.php => ApplicationTest.php} (98%) rename tests/framework/{test-bootloader.php => BootloaderTest.php} (98%) rename tests/framework/{test-isolated-framework.php => IsolatedFrameworkTest.php} (95%) rename tests/framework/{test-pipeline.php => PipelineTest.php} (99%) rename tests/framework/blocks/{test-block-provider.php => BlockProviderTest.php} (97%) rename tests/framework/events/{test-discover-events.php => DiscoverEventsTest.php} (97%) rename tests/framework/helpers/{test-nullable-comment-objects-test-case.php => NullableCommentObjectsTestCaseTest.php} (92%) rename tests/framework/helpers/{test-nullable-post-objects-test-case.php => NullablePostObjectsTestCaseTest.php} (94%) create mode 100644 tests/framework/helpers/NullableSiteObjectsTestCaseTest.php rename tests/framework/helpers/{test-nullable-term-objects-test-case.php => NullableTermObjectsTestCaseTest.php} (97%) rename tests/framework/helpers/{test-nullable-user-objects-test-case.php => NullableUserObjectsTestCaseTest.php} (95%) delete mode 100644 tests/framework/helpers/test-nullable-site-objects-test-case.php rename tests/helpers/{test-helpers-array.php => HelpersArrayTest.php} (99%) rename tests/helpers/{test-helpers-general.php => HelpersGeneralTest.php} (98%) rename tests/helpers/{test-helpers.php => HelpersTest.php} (98%) rename tests/http-client/{test-http-client.php => HttpClientTest.php} (99%) rename tests/http/{test-controller.php => ControllerTest.php} (97%) rename tests/http/{test-redirector.php => RedirectorTest.php} (98%) rename tests/http/{test-response-factory.php => ResponseFactoryTest.php} (93%) rename tests/http/{test-router.php => RouterTest.php} (99%) rename tests/http/{test-uploaded-file.php => UploadedFileTest.php} (94%) rename tests/http/{test-url-generator.php => UrlGeneratorTest.php} (98%) rename tests/http/routing/{test-post-model-routing.php => PostModelRoutingTest.php} (97%) rename tests/http/routing/{test-rest-api-routing.php => RestApiRoutingTest.php} (98%) rename tests/http/routing/{test-term-model-routing.php => TermModelRoutingTest.php} (98%) rename tests/log/{test-log-manager.php => LogManagerTest.php} (97%) rename tests/queue/{test-dispatcher.php => DispatcherTest.php} (96%) rename tests/queue/{test-queue-manager.php => QueueManagerTest.php} (94%) rename tests/queue/{test-worker.php => WorkerTest.php} (98%) rename tests/queue/providers/{test-wordpress-cron-queue.php => WordPressCronQueueTest.php} (98%) rename tests/scheduling/{test-event.php => EventTest.php} (97%) rename tests/scheduling/{test-frequency.php => FrequencyTest.php} (98%) rename tests/support/{test-arr.php => ArrTest.php} (99%) rename tests/support/{test-collection.php => CollectionTest.php} (99%) rename tests/support/{test-environment.php => EnvironmentTest.php} (94%) rename tests/support/{test-forward-calls.php => ForwardCallsTest.php} (98%) rename tests/support/{test-pluralizer.php => PluralizerTest.php} (99%) rename tests/support/{test-service-provider.php => ServiceProviderTest.php} (99%) rename tests/support/{test-str.php => StrTest.php} (99%) rename tests/support/{test-stringable.php => StringableTest.php} (99%) rename tests/support/providers/{test-model-register-provider.php => ModelRegisterProviderTest.php} (94%) rename tests/testing/{test-core-test-shim.php => CoreTestShimTest.php} (88%) rename tests/testing/{test-permalink-structure.php => PermalinkStructureTest.php} (97%) rename tests/testing/{test-with-faker.php => WithFakerTest.php} (70%) rename tests/testing/concerns/{test-block-assertions.php => BlockAssertionsTest.php} (95%) rename tests/testing/concerns/{test-deprecations.php => DeprecationsTest.php} (96%) rename tests/testing/concerns/{test-element-assertions.php => ElementAssertionsTest.php} (96%) rename tests/testing/concerns/{test-incorrect-usage.php => IncorrectUsageTest.php} (96%) rename tests/testing/concerns/{test-interacts-with-console.php => InteractsWithConsoleTest.php} (95%) rename tests/testing/concerns/{test-interacts-with-external-requests.php => InteractsWithExternalRequestsTest.php} (99%) rename tests/testing/concerns/{test-interacts-with-hooks.php => InteractsWithHooksTest.php} (98%) rename tests/testing/concerns/{test-makes-http-requests.php => MakesHttpRequestsTest.php} (99%) rename tests/testing/concerns/{test-wordpress-authentication.php => WordPressAuthenticationTest.php} (93%) create mode 100644 tests/testing/concerns/__snapshots__/MakesHttpRequestsTest__test_match_snapshot__1.yml create mode 100644 tests/testing/concerns/__snapshots__/MakesHttpRequestsTest__test_match_snapshot_http__1.html create mode 100644 tests/testing/concerns/__snapshots__/MakesHttpRequestsTest__test_match_snapshot_http_partial__1.html create mode 100644 tests/testing/concerns/__snapshots__/MakesHttpRequestsTest__test_match_snapshot_rest__1.json create mode 100644 tests/testing/concerns/__snapshots__/MakesHttpRequestsTest__test_match_snapshot_rest__2.json create mode 100644 tests/testing/concerns/__snapshots__/MakesHttpRequestsTest__test_match_snapshot_rest__3.json create mode 100644 tests/testing/concerns/__snapshots__/MakesHttpRequestsTest__test_multiple_requests__1.yml rename tests/testkit/{test-testkit-install-wordpress.php => TestkitInstallWordPressTest.php} (92%) rename tests/testkit/{test-testkit-test-case.php => TestkitTestCaseTest.php} (87%) rename tests/testkit/{test-with-faker.php => WithFakerTest.php} (85%) rename tests/testkit/concerns/{trait-example-overload.php => ExampleOverload.php} (83%) rename tests/view/{test-blade-views.php => BladeViewsTest.php} (93%) rename tests/view/{test-file-engine.php => FileEngineTest.php} (91%) rename tests/view/{test-php-views.php => PhpViewsTest.php} (99%) rename tests/view/{test-view-finder.php => ViewFinderTest.php} (96%) diff --git a/phpunit.xml b/phpunit.xml index 187fa7a0..730c58b4 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -9,7 +9,7 @@ > - ./tests/ + ./tests/ diff --git a/src/mantle/testing/class-assert.php b/src/mantle/testing/class-assert.php deleted file mode 100644 index 0d97a232..00000000 --- a/src/mantle/testing/class-assert.php +++ /dev/null @@ -1,54 +0,0 @@ -maybe_rsync_plugin() ->with_vip_mu_plugins() diff --git a/tests/cache/test-cache-manager.php b/tests/cache/CacheManagerTest.php similarity index 97% rename from tests/cache/test-cache-manager.php rename to tests/cache/CacheManagerTest.php index aeae9f91..6bc70c21 100644 --- a/tests/cache/test-cache-manager.php +++ b/tests/cache/CacheManagerTest.php @@ -7,7 +7,7 @@ use Mantle\Testing\Framework_Test_Case; use Predis\Connection\ConnectionException; -class Test_Cache_Manager extends Framework_Test_Case { +class CacheManagerTest extends Framework_Test_Case { public function test_unconfigured_store() { $this->expectException( InvalidArgumentException::class ); $this->expectExceptionMessage( 'Driver not specified for [invalid-store].' ); diff --git a/tests/config/test-repository.php b/tests/config/RepositoryTest.php similarity index 97% rename from tests/config/test-repository.php rename to tests/config/RepositoryTest.php index 7858361f..7f1b53cd 100644 --- a/tests/config/test-repository.php +++ b/tests/config/RepositoryTest.php @@ -4,7 +4,7 @@ use Mantle\Config\Repository; use PHPUnit\Framework\TestCase; -class Test_Repository extends TestCase { +class RepositoryTest extends TestCase { /** * @var Repository */ diff --git a/tests/console/test-command.php b/tests/console/CommandTest.php similarity index 98% rename from tests/console/test-command.php rename to tests/console/CommandTest.php index a5c15a24..ceab1625 100644 --- a/tests/console/test-command.php +++ b/tests/console/CommandTest.php @@ -9,7 +9,7 @@ use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Output\NullOutput; -class Test_Command extends TestCase { +class CommandTest extends TestCase { public function test_registering_command_with_just_name() { $command = new class extends Command { diff --git a/tests/console/test-generator-command.php b/tests/console/GeneratorCommandTest.php similarity index 98% rename from tests/console/test-generator-command.php rename to tests/console/GeneratorCommandTest.php index 6622020b..46b25add 100644 --- a/tests/console/test-generator-command.php +++ b/tests/console/GeneratorCommandTest.php @@ -13,7 +13,7 @@ use Mantle\Framework\Console\Generators\Stub_Generator_Command; use Mockery as m; -class Test_Generator_Command extends \Mockery\Adapter\Phpunit\MockeryTestCase { +class GeneratorCommandTest extends \Mockery\Adapter\Phpunit\MockeryTestCase { /** * @var Application */ diff --git a/tests/console/test-hook-usage-command.php b/tests/console/HookUsageCommandTest.php.bak similarity index 96% rename from tests/console/test-hook-usage-command.php rename to tests/console/HookUsageCommandTest.php.bak index 0618b1af..06b8c35d 100644 --- a/tests/console/test-hook-usage-command.php +++ b/tests/console/HookUsageCommandTest.php.bak @@ -12,7 +12,7 @@ use Mantle\Testing\Framework_Test_Case; // Disabling until command testing is reimplimented. -// class Test_Hook_Usage_Command extends Framework_Test_Case { +// class HookUsageCommandTest extends Framework_Test_Case { // public function test_do_action() { // $usage = $this->run_command( 'init' )->all(); diff --git a/tests/console/test-parser.php b/tests/console/ParserTest.php similarity index 99% rename from tests/console/test-parser.php rename to tests/console/ParserTest.php index a4d35190..71674889 100644 --- a/tests/console/test-parser.php +++ b/tests/console/ParserTest.php @@ -6,7 +6,7 @@ use InvalidArgumentException; use PHPUnit\Framework\TestCase; -class Test_Parser extends TestCase { +class ParserTest extends TestCase { public function testBasicParameterParsing() { $results = Parser::parse( 'command:name' ); diff --git a/tests/console/generators/test-printer.php b/tests/console/generators/PrinterTest.php similarity index 98% rename from tests/console/generators/test-printer.php rename to tests/console/generators/PrinterTest.php index badb2e83..4b9b8bf5 100644 --- a/tests/console/generators/test-printer.php +++ b/tests/console/generators/PrinterTest.php @@ -7,7 +7,7 @@ use PHP_CodeSniffer\Runner; use PHPUnit\Framework\TestCase; -class Test_Printer extends TestCase { +class PrinterTest extends TestCase { protected static $temp_dir; protected static $argv; diff --git a/tests/container/test-container-call.php b/tests/container/ContainerCallTest.php similarity index 99% rename from tests/container/test-container-call.php rename to tests/container/ContainerCallTest.php index 62a14321..0b575a61 100644 --- a/tests/container/test-container-call.php +++ b/tests/container/ContainerCallTest.php @@ -10,7 +10,7 @@ use ReflectionException; use stdClass; -class Test_Container_Call extends TestCase { +class ContainerCallTest extends TestCase { public function testCallWithAtSignBasedClassReferencesWithoutMethodThrowsException() { $this->expectException( Error::class ); @@ -188,7 +188,7 @@ public function testCallWithoutRequiredParamsThrowsException() { public function testCallWithoutRequiredParamsOnClosureThrowsException() { $this->expectException( Binding_Resolution_Exception::class ); - $this->expectExceptionMessage( 'Unable to resolve dependency [Parameter #0 [ $foo ]] in class Mantle\Tests\Container\Test_Container_Call' ); + $this->expectExceptionMessage( 'Unable to resolve dependency [Parameter #0 [ $foo ]] in class Mantle\Tests\Container\ContainerCallTest' ); $container = new Container(); $foo = $container->call( diff --git a/tests/container/test-container.php b/tests/container/ContainerTest.php similarity index 99% rename from tests/container/test-container.php rename to tests/container/ContainerTest.php index aab2526b..cb3330d5 100644 --- a/tests/container/test-container.php +++ b/tests/container/ContainerTest.php @@ -8,7 +8,7 @@ use Psr\Container\ContainerExceptionInterface; use stdClass; -class Test_Container extends TestCase { +class ContainerTest extends TestCase { protected function tearDown(): void { Container::set_instance( null ); } @@ -443,7 +443,7 @@ function () { public function testMakeWithMethodIsAnAliasForMakeMethod() { $mock = $this->getMockBuilder( Container::class ) - ->setMethods( [ 'make' ] ) + ->onlyMethods( [ 'make' ] ) ->getMock(); $mock->expects( $this->once() ) diff --git a/tests/database/factory/test-factory.php b/tests/database/factory/FactoryTest.php similarity index 99% rename from tests/database/factory/test-factory.php rename to tests/database/factory/FactoryTest.php index 67cd6992..08cde70c 100644 --- a/tests/database/factory/test-factory.php +++ b/tests/database/factory/FactoryTest.php @@ -9,7 +9,7 @@ /** * @group factory */ -class Test_Factory extends Framework_Test_Case { +class FactoryTest extends Framework_Test_Case { public function test_create_basic_model() { $factory = Testable_Post::factory(); diff --git a/tests/database/factory/test-unit-testing-factory.php b/tests/database/factory/UnitTestingFactoryTest.php similarity index 99% rename from tests/database/factory/test-unit-testing-factory.php rename to tests/database/factory/UnitTestingFactoryTest.php index 54cf3b81..2a75c210 100644 --- a/tests/database/factory/test-unit-testing-factory.php +++ b/tests/database/factory/UnitTestingFactoryTest.php @@ -17,7 +17,7 @@ * * @group factory */ -class Test_Unit_Testing_Factory extends Framework_Test_Case { +class UnitTestingFactoryTest extends Framework_Test_Case { use With_Faker; public function test_post_factory() { diff --git a/tests/database/model/test-attachment.php b/tests/database/model/AttachmentTest.php similarity index 93% rename from tests/database/model/test-attachment.php rename to tests/database/model/AttachmentTest.php index 78d479f7..ed9d15b3 100644 --- a/tests/database/model/test-attachment.php +++ b/tests/database/model/AttachmentTest.php @@ -4,7 +4,7 @@ use Mantle\Database\Model\Attachment; use Mantle\Testing\Framework_Test_Case; -class Test_Attachment extends Framework_Test_Case { +class AttachmentTest extends Framework_Test_Case { /** * @var int */ diff --git a/tests/database/model/test-comment-object.php b/tests/database/model/CommentObjectTest.php similarity index 97% rename from tests/database/model/test-comment-object.php rename to tests/database/model/CommentObjectTest.php index c5161fb1..185ac08e 100644 --- a/tests/database/model/test-comment-object.php +++ b/tests/database/model/CommentObjectTest.php @@ -5,7 +5,7 @@ use Mantle\Testing\Framework_Test_Case; -class Test_Comment_Object extends Framework_Test_Case { +class CommentObjectTest extends Framework_Test_Case { public function test_comment_object() { $comment = $this->factory->comment->create_and_get(); $object = Comment::find( $comment ); diff --git a/tests/database/model/test-model-scope.php b/tests/database/model/ModelScopeTest.php similarity index 98% rename from tests/database/model/test-model-scope.php rename to tests/database/model/ModelScopeTest.php index 8986932b..06b60458 100644 --- a/tests/database/model/test-model-scope.php +++ b/tests/database/model/ModelScopeTest.php @@ -9,7 +9,7 @@ use Mantle\Database\Query\Post_Query_Builder; use Mantle\Testing\Framework_Test_Case; -class Test_Model_Scope extends Framework_Test_Case { +class ModelScopeTest extends Framework_Test_Case { public function test_local_scope() { $post_id = $this->get_random_post_id(); diff --git a/tests/database/model/test-model.php b/tests/database/model/ModelTest.php similarity index 99% rename from tests/database/model/test-model.php rename to tests/database/model/ModelTest.php index 1a830b35..f0ac5b15 100644 --- a/tests/database/model/test-model.php +++ b/tests/database/model/ModelTest.php @@ -9,7 +9,7 @@ /** * Test non-WordPress specific logic of the model */ -class Test_Model extends Framework_Test_Case { +class ModelTest extends Framework_Test_Case { protected function setUp(): void { parent::setUp(); diff --git a/tests/database/model/test-permalink-generator.php b/tests/database/model/PermalinkGeneratorTest.php similarity index 94% rename from tests/database/model/test-permalink-generator.php rename to tests/database/model/PermalinkGeneratorTest.php index 9481b04e..92b9892c 100644 --- a/tests/database/model/test-permalink-generator.php +++ b/tests/database/model/PermalinkGeneratorTest.php @@ -5,7 +5,7 @@ use Mantle\Database\Model\Post; use Mantle\Testing\Framework_Test_Case; -class Test_Permalink_Generator extends Framework_Test_Case { +class PermalinkGeneratorTest extends Framework_Test_Case { public function test_generate_permalink() { $post = static::factory()->post->create_and_get(); $model = Testable_Post_Generator::find( $post->ID ); diff --git a/tests/database/model/test-post-model-events.php b/tests/database/model/PostModelEventsTest.php similarity index 98% rename from tests/database/model/test-post-model-events.php rename to tests/database/model/PostModelEventsTest.php index f78a3eb7..72b73674 100644 --- a/tests/database/model/test-post-model-events.php +++ b/tests/database/model/PostModelEventsTest.php @@ -7,7 +7,7 @@ /** * Test non-WordPress specific logic of the model */ -class Test_Post_Model_Events extends Framework_Test_Case { +class PostModelEventsTest extends Framework_Test_Case { public function setUp(): void { parent::setUp(); diff --git a/tests/database/model/test-post-object.php b/tests/database/model/PostObjectTest.php similarity index 99% rename from tests/database/model/test-post-object.php rename to tests/database/model/PostObjectTest.php index 6ecc6a01..9becccce 100644 --- a/tests/database/model/test-post-object.php +++ b/tests/database/model/PostObjectTest.php @@ -10,7 +10,7 @@ use Mantle\Testing\Framework_Test_Case; use Mantle\Testing\Utils; -class Test_Post_Object extends Framework_Test_Case { +class PostObjectTest extends Framework_Test_Case { use Refresh_Database; protected function setUp(): void { diff --git a/tests/database/model/test-rest-field.php b/tests/database/model/RestFieldTest.php similarity index 93% rename from tests/database/model/test-rest-field.php rename to tests/database/model/RestFieldTest.php index 6a0aa92f..ca8b5536 100644 --- a/tests/database/model/test-rest-field.php +++ b/tests/database/model/RestFieldTest.php @@ -5,7 +5,7 @@ use Mantle\Database\Model\Registration\Register_Rest_Fields; use Mantle\Testing\Framework_Test_Case; -class Test_Rest_Field extends Framework_Test_Case { +class RestFieldTest extends Framework_Test_Case { public function test_rest_field() { Testable_Model_With_Rest_Field::boot_if_not_booted(); diff --git a/tests/database/model/test-site-object.php b/tests/database/model/SiteObjectTest.php similarity index 94% rename from tests/database/model/test-site-object.php rename to tests/database/model/SiteObjectTest.php index 00537b04..e58c26d6 100644 --- a/tests/database/model/test-site-object.php +++ b/tests/database/model/SiteObjectTest.php @@ -6,7 +6,7 @@ use Mantle\Testing\Framework_Test_Case; -class Test_Site_Object extends Framework_Test_Case { +class SiteObjectTest extends Framework_Test_Case { use Multisite_Test; public function test_site_attributes() { diff --git a/tests/database/model/test-term-model-events.php b/tests/database/model/TermModelEventsTest.php similarity index 98% rename from tests/database/model/test-term-model-events.php rename to tests/database/model/TermModelEventsTest.php index 42b4d69e..e5496388 100644 --- a/tests/database/model/test-term-model-events.php +++ b/tests/database/model/TermModelEventsTest.php @@ -7,7 +7,7 @@ /** * Test non-WordPress specific logic of the model */ -class Test_Term_Model_Events extends Framework_Test_Case { +class TermModelEventsTest extends Framework_Test_Case { public function setUp(): void { parent::setUp(); diff --git a/tests/database/model/test-term-object.php b/tests/database/model/TermObjectTest.php similarity index 98% rename from tests/database/model/test-term-object.php rename to tests/database/model/TermObjectTest.php index d8c127d1..0aac358b 100644 --- a/tests/database/model/test-term-object.php +++ b/tests/database/model/TermObjectTest.php @@ -8,7 +8,7 @@ use Mantle\Testing\Framework_Test_Case; -class Test_Term_Object extends Framework_Test_Case { +class TermObjectTest extends Framework_Test_Case { protected function setUp(): void { parent::setUp(); Example_Taxonomy::register_object(); diff --git a/tests/database/model/test-user-object.php b/tests/database/model/UserObjectTest.php similarity index 97% rename from tests/database/model/test-user-object.php rename to tests/database/model/UserObjectTest.php index 41935e03..07bcfa5c 100644 --- a/tests/database/model/test-user-object.php +++ b/tests/database/model/UserObjectTest.php @@ -5,7 +5,7 @@ use Mantle\Database\Model\User; use Mantle\Testing\Framework_Test_Case; -class Test_User_Object extends Framework_Test_Case { +class UserObjectTest extends Framework_Test_Case { /** * @var Factory */ diff --git a/tests/database/model/registration/test-register-meta.php b/tests/database/model/registration/RegisterMetaTest.php similarity index 95% rename from tests/database/model/registration/test-register-meta.php rename to tests/database/model/registration/RegisterMetaTest.php index 1853b460..25a59c1d 100644 --- a/tests/database/model/registration/test-register-meta.php +++ b/tests/database/model/registration/RegisterMetaTest.php @@ -6,7 +6,7 @@ use Mantle\Database\Model\Registration\Register_Meta; use Mantle\Testing\Framework_Test_Case; -class Test_Register_Meta extends Framework_Test_Case { +class RegisterMetaTest extends Framework_Test_Case { public function test_register_meta() { $this->expectApplied( 'mantle_register_meta_default_args' )->once()->andReturn( [ diff --git a/tests/database/model/registration/test-register-post-type.php b/tests/database/model/registration/RegisterPostTypeTest.php similarity index 98% rename from tests/database/model/registration/test-register-post-type.php rename to tests/database/model/registration/RegisterPostTypeTest.php index 4a93f25c..3864aa7e 100644 --- a/tests/database/model/registration/test-register-post-type.php +++ b/tests/database/model/registration/RegisterPostTypeTest.php @@ -11,7 +11,7 @@ use Mantle\REST_API\Registered_REST_Field; use Mantle\Testing\Framework_Test_Case; -class Test_Register_Post_Type extends Framework_Test_Case { +class RegisterPostTypeTest extends Framework_Test_Case { protected function setUp(): void { parent::setUp(); remove_all_actions( 'init' ); diff --git a/tests/database/model/registration/test-register-taxonomy.php b/tests/database/model/registration/RegisterTaxonomyTest.php similarity index 96% rename from tests/database/model/registration/test-register-taxonomy.php rename to tests/database/model/registration/RegisterTaxonomyTest.php index 29366ad6..e053c028 100644 --- a/tests/database/model/registration/test-register-taxonomy.php +++ b/tests/database/model/registration/RegisterTaxonomyTest.php @@ -6,7 +6,7 @@ use Mantle\Testing\Framework_Test_Case; use Mockery as m; -class Test_Register_Taxonomy extends Framework_Test_Case { +class RegisterTaxonomyTest extends Framework_Test_Case { protected function setUp(): void { parent::setUp(); remove_all_actions( 'init' ); diff --git a/tests/database/model/relations/test-belongs-to-one-or-many.php b/tests/database/model/relations/BelongsToOneOrManyTest.php similarity index 98% rename from tests/database/model/relations/test-belongs-to-one-or-many.php rename to tests/database/model/relations/BelongsToOneOrManyTest.php index 8b96f577..e58c866f 100644 --- a/tests/database/model/relations/test-belongs-to-one-or-many.php +++ b/tests/database/model/relations/BelongsToOneOrManyTest.php @@ -11,7 +11,7 @@ use Mantle\Database\Model\Term; use Mantle\Database\Model_Service_Provider; -class Test_Belongs_To_One_Or_Many extends Framework_Test_Case { +class BelongsToOneOrManyTest extends Framework_Test_Case { protected function setUp(): void { parent::setUp(); diff --git a/tests/database/model/relations/test-has-one-or-many.php b/tests/database/model/relations/HasOneOrManyTest.php similarity index 99% rename from tests/database/model/relations/test-has-one-or-many.php rename to tests/database/model/relations/HasOneOrManyTest.php index 223ad9a8..c8dd0054 100644 --- a/tests/database/model/relations/test-has-one-or-many.php +++ b/tests/database/model/relations/HasOneOrManyTest.php @@ -12,7 +12,7 @@ use Mantle\Testing\Framework_Test_Case; use Mantle\Testing\Utils; -class Test_Has_One_Or_Many extends Framework_Test_Case { +class HasOneOrManyTest extends Framework_Test_Case { use Refresh_Database; protected function setUp(): void { diff --git a/tests/database/query/test-eager-load-relationships.php b/tests/database/query/EagerLoadRelationshipsTest.php similarity index 99% rename from tests/database/query/test-eager-load-relationships.php rename to tests/database/query/EagerLoadRelationshipsTest.php index 52d52d8a..9d458f56 100644 --- a/tests/database/query/test-eager-load-relationships.php +++ b/tests/database/query/EagerLoadRelationshipsTest.php @@ -9,7 +9,7 @@ use function Mantle\Support\Helpers\collect; -class Test_Eager_Load_Relationships extends Framework_Test_Case { +class EagerLoadRelationshipsTest extends Framework_Test_Case { use Refresh_Database; protected function setUp(): void { diff --git a/tests/database/query/test-paginator.php b/tests/database/query/PaginatorTest.php similarity index 99% rename from tests/database/query/test-paginator.php rename to tests/database/query/PaginatorTest.php index dcafc0f3..0f415c0f 100644 --- a/tests/database/query/test-paginator.php +++ b/tests/database/query/PaginatorTest.php @@ -7,7 +7,7 @@ use Mantle\Testing\Framework_Test_Case; -class Test_Paginator extends Framework_Test_Case { +class PaginatorTest extends Framework_Test_Case { use Refresh_Database; public function test_simple_paginate_url_query_string() { diff --git a/tests/database/query/test-post-query-builder.php b/tests/database/query/PostQueryBuilderTest.php similarity index 99% rename from tests/database/query/test-post-query-builder.php rename to tests/database/query/PostQueryBuilderTest.php index 73c0ba32..4e52448c 100644 --- a/tests/database/query/test-post-query-builder.php +++ b/tests/database/query/PostQueryBuilderTest.php @@ -13,7 +13,7 @@ use function Mantle\Support\Helpers\collect; -class Test_Post_Query_Builder extends Framework_Test_Case { +class PostQueryBuilderTest extends Framework_Test_Case { use Refresh_Database; protected function setUp(): void { diff --git a/tests/database/query/test-post-query-relationships.php b/tests/database/query/PostQueryRelationshipsTest.php similarity index 97% rename from tests/database/query/test-post-query-relationships.php rename to tests/database/query/PostQueryRelationshipsTest.php index 6c91ed95..ffc156c4 100644 --- a/tests/database/query/test-post-query-relationships.php +++ b/tests/database/query/PostQueryRelationshipsTest.php @@ -9,7 +9,7 @@ use Mantle\Testing\Framework_Test_Case; use Mantle\Testing\Utils; -class Test_Post_Query_Relationships extends Framework_Test_Case { +class PostQueryRelationshipsTest extends Framework_Test_Case { protected function setUp(): void { Utils::delete_all_posts(); parent::setUp(); diff --git a/tests/database/query/test-term-query-builder.php b/tests/database/query/TermQueryBuilderTest.php similarity index 98% rename from tests/database/query/test-term-query-builder.php rename to tests/database/query/TermQueryBuilderTest.php index 5dbcf0e6..406f2df0 100644 --- a/tests/database/query/test-term-query-builder.php +++ b/tests/database/query/TermQueryBuilderTest.php @@ -7,7 +7,7 @@ use function Mantle\Support\Helpers\collect; -class Test_Term_Query_Builder extends Framework_Test_Case { +class TermQueryBuilderTest extends Framework_Test_Case { public function test_term_by_name() { $tag_id = $this->get_random_term_id(); $tag = \get_term( $tag_id ); diff --git a/tests/events/test-event-dispatcher.php b/tests/events/EventDispatcherTest.php similarity index 97% rename from tests/events/test-event-dispatcher.php rename to tests/events/EventDispatcherTest.php index 3133fd54..de5a9077 100644 --- a/tests/events/test-event-dispatcher.php +++ b/tests/events/EventDispatcherTest.php @@ -8,7 +8,7 @@ /** * @group events */ -class Test_Event_Dispatcher extends \Mockery\Adapter\Phpunit\MockeryTestCase { +class EventDispatcherTest extends \Mockery\Adapter\Phpunit\MockeryTestCase { public function testBasicEventExecution() { unset( $_SERVER['__event.test'] ); $d = new Dispatcher(); diff --git a/tests/events/test-wordpress-action-dispatcher.php b/tests/events/WordPressActionDispatcherTest.php similarity index 98% rename from tests/events/test-wordpress-action-dispatcher.php rename to tests/events/WordPressActionDispatcherTest.php index 297e0cea..b23ea070 100644 --- a/tests/events/test-wordpress-action-dispatcher.php +++ b/tests/events/WordPressActionDispatcherTest.php @@ -12,7 +12,7 @@ /** * @group events */ -class Test_WordPress_Action_Dispatcher extends Framework_Test_Case { +class WordPressActionDispatcherTest extends Framework_Test_Case { public function test_action_handler() { $_SERVER['__action_fired'] = false; diff --git a/tests/filesystem/test-filesystem-adapter.php b/tests/filesystem/FilesystemAdapterTest.php similarity index 98% rename from tests/filesystem/test-filesystem-adapter.php rename to tests/filesystem/FilesystemAdapterTest.php index 45b12337..a790fc65 100644 --- a/tests/filesystem/test-filesystem-adapter.php +++ b/tests/filesystem/FilesystemAdapterTest.php @@ -15,7 +15,7 @@ use Mockery as m; use Symfony\Component\HttpFoundation\StreamedResponse; -class Test_Filesystem_Adapter extends TestCase { +class FilesystemAdapterTest extends TestCase { private $temp_dir; /** @@ -137,7 +137,7 @@ public function testDelete() { file_put_contents( $this->temp_dir . '/file.txt', 'Hello World' ); $Filesystem_Adapter = new Filesystem_Adapter( $this->filesystem ); $this->assertTrue( $Filesystem_Adapter->delete( 'file.txt' ) ); - Assert::assertFileDoesNotExist( $this->temp_dir . '/file.txt' ); + $this->assertFileDoesNotExist( $this->temp_dir . '/file.txt' ); } public function testDeleteReturnsFalseWhenFileNotFound() { @@ -168,7 +168,7 @@ public function testMove() { $Filesystem_Adapter = new Filesystem_Adapter( $this->filesystem ); $Filesystem_Adapter->move( '/foo/foo.txt', '/foo/foo2.txt' ); - Assert::assertFileDoesNotExist( $this->temp_dir . '/foo/foo.txt' ); + $this->assertFileDoesNotExist( $this->temp_dir . '/foo/foo.txt' ); $this->assertFileExists( $this->temp_dir . '/foo/foo2.txt' ); $this->assertEquals( $data, file_get_contents( $this->temp_dir . '/foo/foo2.txt' ) ); diff --git a/tests/filesystem/test-filesystem-manager.php b/tests/filesystem/FilesystemManagerTest.php similarity index 97% rename from tests/filesystem/test-filesystem-manager.php rename to tests/filesystem/FilesystemManagerTest.php index 1ef4988f..0eef4382 100644 --- a/tests/filesystem/test-filesystem-manager.php +++ b/tests/filesystem/FilesystemManagerTest.php @@ -10,7 +10,7 @@ use Mantle\Contracts\Filesystem\Filesystem as Filesystem_Contract; use function Mantle\Support\Helpers\tap; -class Test_Filesystem_Manager extends TestCase { +class FilesystemManagerTest extends TestCase { public function test_invalid_disk() { $this->expectException( InvalidArgumentException::class ); $this->expectExceptionMessage( 'Disk [unsupported] does not have a configured driver.' ); diff --git a/tests/filesystem/test-filesystem.php b/tests/filesystem/FilesystemTest.php similarity index 67% rename from tests/filesystem/test-filesystem.php rename to tests/filesystem/FilesystemTest.php index b97a8326..e54cb081 100644 --- a/tests/filesystem/test-filesystem.php +++ b/tests/filesystem/FilesystemTest.php @@ -9,7 +9,7 @@ use SplFileInfo; use League\Flysystem\FileNotFoundException; -class Test_Filesystem extends TestCase { +class FilesystemTest extends TestCase { private static $temp_dir; @@ -43,13 +43,13 @@ protected function tearDown(): void { public function testGetRetrievesFiles() { file_put_contents( static::$temp_dir . '/file.txt', 'Hello World' ); $files = new Filesystem(); - Assert::assertSame( 'Hello World', $files->get( static::$temp_dir . '/file.txt' ) ); + $this->assertSame( 'Hello World', $files->get( static::$temp_dir . '/file.txt' ) ); } public function testPutStoresFiles() { $files = new Filesystem(); $files->put( static::$temp_dir . '/file.txt', 'Hello World' ); - Assert::assertStringEqualsFile( static::$temp_dir . '/file.txt', 'Hello World' ); + $this->assertStringEqualsFile( static::$temp_dir . '/file.txt', 'Hello World' ); } public function testReplaceCreatesFile() { @@ -58,7 +58,7 @@ public function testReplaceCreatesFile() { $filesystem = new Filesystem(); $filesystem->replace( $tempFile, 'Hello World' ); - Assert::assertStringEqualsFile( $tempFile, 'Hello World' ); + $this->assertStringEqualsFile( $tempFile, 'Hello World' ); } public function testReplaceWhenUnixSymlinkExists() { @@ -80,18 +80,18 @@ public function testReplaceWhenUnixSymlinkExists() { // Test replacing non-existent file. $filesystem->replace( $tempFile, 'Hello World' ); - Assert::assertStringEqualsFile( $tempFile, 'Hello World' ); - Assert::assertEquals( $umask, 0777 - $this->get_file_permissions( $tempFile ) ); + $this->assertStringEqualsFile( $tempFile, 'Hello World' ); + $this->assertEquals( $umask, 0777 - $this->get_file_permissions( $tempFile ) ); // Test replacing existing file. $filesystem->replace( $tempFile, 'Something Else' ); - Assert::assertStringEqualsFile( $tempFile, 'Something Else' ); - Assert::assertEquals( $umask, 0777 - $this->get_file_permissions( $tempFile ) ); + $this->assertStringEqualsFile( $tempFile, 'Something Else' ); + $this->assertEquals( $umask, 0777 - $this->get_file_permissions( $tempFile ) ); // Test replacing symlinked file. $filesystem->replace( $symlink, 'Yet Something Else Again' ); - Assert::assertStringEqualsFile( $tempFile, 'Yet Something Else Again' ); - Assert::assertEquals( $umask, 0777 - $this->get_file_permissions( $tempFile ) ); + $this->assertStringEqualsFile( $tempFile, 'Yet Something Else Again' ); + $this->assertEquals( $umask, 0777 - $this->get_file_permissions( $tempFile ) ); umask( $originalUmask ); @@ -105,7 +105,7 @@ public function testSetChmod() { $files->chmod( static::$temp_dir . '/file.txt', 0755 ); $filePermission = substr( sprintf( '%o', fileperms( static::$temp_dir . '/file.txt' ) ), -4 ); $expectedPermissions = DIRECTORY_SEPARATOR == '\\' ? '0666' : '0755'; - Assert::assertEquals( $expectedPermissions, $filePermission ); + $this->assertEquals( $expectedPermissions, $filePermission ); } public function testGetChmod() { @@ -115,7 +115,7 @@ public function testGetChmod() { $files = new Filesystem(); $filePermission = $files->chmod( static::$temp_dir . '/file.txt' ); $expectedPermissions = DIRECTORY_SEPARATOR == '\\' ? '0666' : '0755'; - Assert::assertEquals( $expectedPermissions, $filePermission ); + $this->assertEquals( $expectedPermissions, $filePermission ); } public function testDeleteRemovesFiles() { @@ -125,29 +125,29 @@ public function testDeleteRemovesFiles() { $files = new Filesystem(); $files->delete( static::$temp_dir . '/file1.txt' ); - Assert::assertFileDoesNotExist( static::$temp_dir . '/file1.txt' ); + $this->assertFileDoesNotExist( static::$temp_dir . '/file1.txt' ); $files->delete( [ static::$temp_dir . '/file2.txt', static::$temp_dir . '/file3.txt' ] ); - Assert::assertFileDoesNotExist( static::$temp_dir . '/file2.txt' ); - Assert::assertFileDoesNotExist( static::$temp_dir . '/file3.txt' ); + $this->assertFileDoesNotExist( static::$temp_dir . '/file2.txt' ); + $this->assertFileDoesNotExist( static::$temp_dir . '/file3.txt' ); } public function testPrependExistingFiles() { $files = new Filesystem(); $files->put( static::$temp_dir . '/file.txt', 'World' ); $files->prepend( static::$temp_dir . '/file.txt', 'Hello ' ); - Assert::assertStringEqualsFile( static::$temp_dir . '/file.txt', 'Hello World' ); + $this->assertStringEqualsFile( static::$temp_dir . '/file.txt', 'Hello World' ); } public function testPrependNewFiles() { $files = new Filesystem(); $files->prepend( static::$temp_dir . '/file.txt', 'Hello World' ); - Assert::assertStringEqualsFile( static::$temp_dir . '/file.txt', 'Hello World' ); + $this->assertStringEqualsFile( static::$temp_dir . '/file.txt', 'Hello World' ); } public function testMissingFile() { $files = new Filesystem(); - Assert::assertTrue( $files->missing( static::$temp_dir . '/file.txt' ) ); + $this->assertTrue( $files->missing( static::$temp_dir . '/file.txt' ) ); } public function testDeleteDirectory() { @@ -155,15 +155,15 @@ public function testDeleteDirectory() { file_put_contents( static::$temp_dir . '/foo/file.txt', 'Hello World' ); $files = new Filesystem(); $files->delete_directory( static::$temp_dir . '/foo' ); - Assert::assertDirectoryDoesNotExist( static::$temp_dir . '/foo' ); - Assert::assertFileDoesNotExist( static::$temp_dir . '/foo/file.txt' ); + $this->assertDirectoryDoesNotExist( static::$temp_dir . '/foo' ); + $this->assertFileDoesNotExist( static::$temp_dir . '/foo/file.txt' ); } public function testDeleteDirectoryReturnFalseWhenNotADirectory() { mkdir( static::$temp_dir . '/bar' ); file_put_contents( static::$temp_dir . '/bar/file.txt', 'Hello World' ); $files = new Filesystem(); - Assert::assertFalse( $files->delete_directory( static::$temp_dir . '/bar/file.txt' ) ); + $this->assertFalse( $files->delete_directory( static::$temp_dir . '/bar/file.txt' ) ); } public function testCleanDirectory() { @@ -171,8 +171,8 @@ public function testCleanDirectory() { file_put_contents( static::$temp_dir . '/baz/file.txt', 'Hello World' ); $files = new Filesystem(); $files->clean_directory( static::$temp_dir . '/baz' ); - Assert::assertDirectoryExists( static::$temp_dir . '/baz' ); - Assert::assertFileDoesNotExist( static::$temp_dir . '/baz/file.txt' ); + $this->assertDirectoryExists( static::$temp_dir . '/baz' ); + $this->assertFileDoesNotExist( static::$temp_dir . '/baz/file.txt' ); } public function testMacro() { @@ -185,7 +185,7 @@ function () use ( $files, $temp_dir ) { return $files->get( $temp_dir . '/foo.txt' ); } ); - Assert::assertSame( 'Hello World', $files->getFoo() ); + $this->assertSame( 'Hello World', $files->getFoo() ); } public function testFilesMethod() { @@ -195,14 +195,14 @@ public function testFilesMethod() { mkdir( static::$temp_dir . '/views/_layouts' ); $files = new Filesystem(); $results = $files->files( static::$temp_dir . '/views' ); - Assert::assertInstanceOf( SplFileInfo::class, $results[0] ); - Assert::assertInstanceOf( SplFileInfo::class, $results[1] ); + $this->assertInstanceOf( SplFileInfo::class, $results[0] ); + $this->assertInstanceOf( SplFileInfo::class, $results[1] ); unset( $files ); } public function testCopyDirectoryReturnsFalseIfSourceIsntDirectory() { $files = new Filesystem(); - Assert::assertFalse( $files->copy_directory( static::$temp_dir . '/breeze/boom/foo/bar/baz', static::$temp_dir ) ); + $this->assertFalse( $files->copy_directory( static::$temp_dir . '/breeze/boom/foo/bar/baz', static::$temp_dir ) ); } public function testCopyDirectoryMovesEntireDirectory() { @@ -214,11 +214,11 @@ public function testCopyDirectoryMovesEntireDirectory() { $files = new Filesystem(); $files->copy_directory( static::$temp_dir . '/tmp', static::$temp_dir . '/tmp2' ); - Assert::assertDirectoryExists( static::$temp_dir . '/tmp2' ); - Assert::assertFileExists( static::$temp_dir . '/tmp2/foo.txt' ); - Assert::assertFileExists( static::$temp_dir . '/tmp2/bar.txt' ); - Assert::assertDirectoryExists( static::$temp_dir . '/tmp2/nested' ); - Assert::assertFileExists( static::$temp_dir . '/tmp2/nested/baz.txt' ); + $this->assertDirectoryExists( static::$temp_dir . '/tmp2' ); + $this->assertFileExists( static::$temp_dir . '/tmp2/foo.txt' ); + $this->assertFileExists( static::$temp_dir . '/tmp2/bar.txt' ); + $this->assertDirectoryExists( static::$temp_dir . '/tmp2/nested' ); + $this->assertFileExists( static::$temp_dir . '/tmp2/nested/baz.txt' ); } public function testMoveDirectoryMovesEntireDirectory() { @@ -230,12 +230,12 @@ public function testMoveDirectoryMovesEntireDirectory() { $files = new Filesystem(); $files->move_directory( static::$temp_dir . '/tmp2', static::$temp_dir . '/tmp3' ); - Assert::assertDirectoryExists( static::$temp_dir . '/tmp3' ); - Assert::assertFileExists( static::$temp_dir . '/tmp3/foo.txt' ); - Assert::assertFileExists( static::$temp_dir . '/tmp3/bar.txt' ); - Assert::assertDirectoryExists( static::$temp_dir . '/tmp3/nested' ); - Assert::assertFileExists( static::$temp_dir . '/tmp3/nested/baz.txt' ); - Assert::assertDirectoryDoesNotExist( static::$temp_dir . '/tmp2' ); + $this->assertDirectoryExists( static::$temp_dir . '/tmp3' ); + $this->assertFileExists( static::$temp_dir . '/tmp3/foo.txt' ); + $this->assertFileExists( static::$temp_dir . '/tmp3/bar.txt' ); + $this->assertDirectoryExists( static::$temp_dir . '/tmp3/nested' ); + $this->assertFileExists( static::$temp_dir . '/tmp3/nested/baz.txt' ); + $this->assertDirectoryDoesNotExist( static::$temp_dir . '/tmp2' ); } public function testMoveDirectoryMovesEntireDirectoryAndOverwrites() { @@ -250,14 +250,14 @@ public function testMoveDirectoryMovesEntireDirectoryAndOverwrites() { $files = new Filesystem(); $files->move_directory( static::$temp_dir . '/tmp4', static::$temp_dir . '/tmp5', true ); - Assert::assertDirectoryExists( static::$temp_dir . '/tmp5' ); - Assert::assertFileExists( static::$temp_dir . '/tmp5/foo.txt' ); - Assert::assertFileExists( static::$temp_dir . '/tmp5/bar.txt' ); - Assert::assertDirectoryExists( static::$temp_dir . '/tmp5/nested' ); - Assert::assertFileExists( static::$temp_dir . '/tmp5/nested/baz.txt' ); - Assert::assertFileDoesNotExist( static::$temp_dir . '/tmp5/foo2.txt' ); - Assert::assertFileDoesNotExist( static::$temp_dir . '/tmp5/bar2.txt' ); - Assert::assertDirectoryDoesNotExist( static::$temp_dir . '/tmp4' ); + $this->assertDirectoryExists( static::$temp_dir . '/tmp5' ); + $this->assertFileExists( static::$temp_dir . '/tmp5/foo.txt' ); + $this->assertFileExists( static::$temp_dir . '/tmp5/bar.txt' ); + $this->assertDirectoryExists( static::$temp_dir . '/tmp5/nested' ); + $this->assertFileExists( static::$temp_dir . '/tmp5/nested/baz.txt' ); + $this->assertFileDoesNotExist( static::$temp_dir . '/tmp5/foo2.txt' ); + $this->assertFileDoesNotExist( static::$temp_dir . '/tmp5/bar2.txt' ); + $this->assertDirectoryDoesNotExist( static::$temp_dir . '/tmp4' ); } public function testMoveDirectoryReturnsFalseWhileOverwritingAndUnableToDeleteDestinationDirectory() { @@ -267,7 +267,7 @@ public function testMoveDirectoryReturnsFalseWhileOverwritingAndUnableToDeleteDe $files = m::mock( Filesystem::class )->makePartial(); $files->shouldReceive( 'delete_directory' )->once()->andReturn( false ); - Assert::assertFalse( $files->move_directory( static::$temp_dir . '/tmp6', static::$temp_dir . '/tmp7', true ) ); + $this->assertFalse( $files->move_directory( static::$temp_dir . '/tmp6', static::$temp_dir . '/tmp7', true ) ); } public function testGetThrowsExceptionNonexisitingFile() { @@ -280,7 +280,7 @@ public function testGetThrowsExceptionNonexisitingFile() { public function testGetRequireReturnsProperly() { file_put_contents( static::$temp_dir . '/file.php', '' ); $files = new Filesystem(); - Assert::assertSame( 'Howdy?', $files->get_require( static::$temp_dir . '/file.php' ) ); + $this->assertSame( 'Howdy?', $files->get_require( static::$temp_dir . '/file.php' ) ); } public function testGetRequireThrowsExceptionNonExistingFile() { @@ -294,59 +294,59 @@ public function testAppendAddsDataToFile() { file_put_contents( static::$temp_dir . '/file.txt', 'foo' ); $files = new Filesystem(); $bytesWritten = $files->append( static::$temp_dir . '/file.txt', 'bar' ); - Assert::assertEquals( mb_strlen( 'bar', '8bit' ), $bytesWritten ); - Assert::assertFileExists( static::$temp_dir . '/file.txt' ); - Assert::assertStringEqualsFile( static::$temp_dir . '/file.txt', 'foobar' ); + $this->assertEquals( mb_strlen( 'bar', '8bit' ), $bytesWritten ); + $this->assertFileExists( static::$temp_dir . '/file.txt' ); + $this->assertStringEqualsFile( static::$temp_dir . '/file.txt', 'foobar' ); } public function testMoveMovesFiles() { file_put_contents( static::$temp_dir . '/foo.txt', 'foo' ); $files = new Filesystem(); $files->move( static::$temp_dir . '/foo.txt', static::$temp_dir . '/bar.txt' ); - Assert::assertFileExists( static::$temp_dir . '/bar.txt' ); - Assert::assertFileDoesNotExist( static::$temp_dir . '/foo.txt' ); + $this->assertFileExists( static::$temp_dir . '/bar.txt' ); + $this->assertFileDoesNotExist( static::$temp_dir . '/foo.txt' ); } public function testNameReturnsName() { file_put_contents( static::$temp_dir . '/foobar.txt', 'foo' ); $filesystem = new Filesystem(); - Assert::assertSame( 'foobar', $filesystem->name( static::$temp_dir . '/foobar.txt' ) ); + $this->assertSame( 'foobar', $filesystem->name( static::$temp_dir . '/foobar.txt' ) ); } public function testExtensionReturnsExtension() { file_put_contents( static::$temp_dir . '/foo.txt', 'foo' ); $files = new Filesystem(); - Assert::assertSame( 'txt', $files->extension( static::$temp_dir . '/foo.txt' ) ); + $this->assertSame( 'txt', $files->extension( static::$temp_dir . '/foo.txt' ) ); } public function testBasenameReturnsBasename() { file_put_contents( static::$temp_dir . '/foo.txt', 'foo' ); $files = new Filesystem(); - Assert::assertSame( 'foo.txt', $files->basename( static::$temp_dir . '/foo.txt' ) ); + $this->assertSame( 'foo.txt', $files->basename( static::$temp_dir . '/foo.txt' ) ); } public function testDirnameReturnsDirectory() { file_put_contents( static::$temp_dir . '/foo.txt', 'foo' ); $files = new Filesystem(); - Assert::assertEquals( static::$temp_dir, $files->dirname( static::$temp_dir . '/foo.txt' ) ); + $this->assertEquals( static::$temp_dir, $files->dirname( static::$temp_dir . '/foo.txt' ) ); } public function testTypeIdentifiesFile() { file_put_contents( static::$temp_dir . '/foo.txt', 'foo' ); $files = new Filesystem(); - Assert::assertSame( 'file', $files->type( static::$temp_dir . '/foo.txt' ) ); + $this->assertSame( 'file', $files->type( static::$temp_dir . '/foo.txt' ) ); } public function testTypeIdentifiesDirectory() { mkdir( static::$temp_dir . '/foo-dir' ); $files = new Filesystem(); - Assert::assertSame( 'dir', $files->type( static::$temp_dir . '/foo-dir' ) ); + $this->assertSame( 'dir', $files->type( static::$temp_dir . '/foo-dir' ) ); } public function testSizeOutputsSize() { $size = file_put_contents( static::$temp_dir . '/foo.txt', 'foo' ); $files = new Filesystem(); - Assert::assertEquals( $size, $files->size( static::$temp_dir . '/foo.txt' ) ); + $this->assertEquals( $size, $files->size( static::$temp_dir . '/foo.txt' ) ); } /** @@ -355,16 +355,16 @@ public function testSizeOutputsSize() { public function testMimeTypeOutputsMimeType() { file_put_contents( static::$temp_dir . '/foo.txt', 'foo' ); $files = new Filesystem(); - Assert::assertSame( 'text/plain', $files->mime_type( static::$temp_dir . '/foo.txt' ) ); + $this->assertSame( 'text/plain', $files->mime_type( static::$temp_dir . '/foo.txt' ) ); } public function testIsWritable() { file_put_contents( static::$temp_dir . '/foo.txt', 'foo' ); $files = new Filesystem(); @chmod( static::$temp_dir . '/foo.txt', 0444 ); - Assert::assertFalse( $files->is_writable( static::$temp_dir . '/foo.txt' ) ); + $this->assertFalse( $files->is_writable( static::$temp_dir . '/foo.txt' ) ); @chmod( static::$temp_dir . '/foo.txt', 0777 ); - Assert::assertTrue( $files->is_writable( static::$temp_dir . '/foo.txt' ) ); + $this->assertTrue( $files->is_writable( static::$temp_dir . '/foo.txt' ) ); } public function testIsReadable() { @@ -372,14 +372,14 @@ public function testIsReadable() { $files = new Filesystem(); // chmod is noneffective on Windows if ( DIRECTORY_SEPARATOR === '\\' ) { - Assert::assertTrue( $files->is_readable( static::$temp_dir . '/foo.txt' ) ); + $this->assertTrue( $files->is_readable( static::$temp_dir . '/foo.txt' ) ); } else { @chmod( static::$temp_dir . '/foo.txt', 0000 ); - Assert::assertFalse( $files->is_readable( static::$temp_dir . '/foo.txt' ) ); + $this->assertFalse( $files->is_readable( static::$temp_dir . '/foo.txt' ) ); @chmod( static::$temp_dir . '/foo.txt', 0777 ); - Assert::assertTrue( $files->is_readable( static::$temp_dir . '/foo.txt' ) ); + $this->assertTrue( $files->is_readable( static::$temp_dir . '/foo.txt' ) ); } - Assert::assertFalse( $files->is_readable( static::$temp_dir . '/doesnotexist.txt' ) ); + $this->assertFalse( $files->is_readable( static::$temp_dir . '/doesnotexist.txt' ) ); } public function testGlobFindsFiles() { @@ -387,8 +387,8 @@ public function testGlobFindsFiles() { file_put_contents( static::$temp_dir . '/bar.txt', 'bar' ); $files = new Filesystem(); $glob = $files->glob( static::$temp_dir . '/*.txt' ); - Assert::assertContains( static::$temp_dir . '/foo.txt', $glob ); - Assert::assertContains( static::$temp_dir . '/bar.txt', $glob ); + $this->assertContains( static::$temp_dir . '/foo.txt', $glob ); + $this->assertContains( static::$temp_dir . '/bar.txt', $glob ); } public function testAllFilesFindsFiles() { @@ -399,8 +399,8 @@ public function testAllFilesFindsFiles() { foreach ( $files->all_files( static::$temp_dir ) as $file ) { $allFiles[] = $file->getFilename(); } - Assert::assertContains( 'foo.txt', $allFiles ); - Assert::assertContains( 'bar.txt', $allFiles ); + $this->assertContains( 'foo.txt', $allFiles ); + $this->assertContains( 'bar.txt', $allFiles ); } public function testDirectoriesFindsDirectories() { @@ -408,14 +408,14 @@ public function testDirectoriesFindsDirectories() { mkdir( static::$temp_dir . '/music' ); $files = new Filesystem(); $directories = $files->directories( static::$temp_dir ); - Assert::assertContains( static::$temp_dir . DIRECTORY_SEPARATOR . 'film', $directories ); - Assert::assertContains( static::$temp_dir . DIRECTORY_SEPARATOR . 'music', $directories ); + $this->assertContains( static::$temp_dir . DIRECTORY_SEPARATOR . 'film', $directories ); + $this->assertContains( static::$temp_dir . DIRECTORY_SEPARATOR . 'music', $directories ); } public function testMakeDirectory() { $files = new Filesystem(); - Assert::assertTrue( $files->make_directory( static::$temp_dir . '/created' ) ); - Assert::assertFileExists( static::$temp_dir . '/created' ); + $this->assertTrue( $files->make_directory( static::$temp_dir . '/created' ) ); + $this->assertFileExists( static::$temp_dir . '/created' ); } public function testRequireOnceRequiresFileProperly() { @@ -425,8 +425,8 @@ public function testRequireOnceRequiresFileProperly() { $filesystem->require_once( static::$temp_dir . '/scripts/foo.php' ); file_put_contents( static::$temp_dir . '/scripts/foo.php', 'require_once( static::$temp_dir . '/scripts/foo.php' ); - Assert::assertTrue( function_exists( 'random_function_xyz' ) ); - Assert::assertFalse( function_exists( 'random_function_xyz_changed' ) ); + $this->assertTrue( function_exists( 'random_function_xyz' ) ); + $this->assertFalse( function_exists( 'random_function_xyz_changed' ) ); } public function testCopyCopiesFileProperly() { @@ -435,16 +435,16 @@ public function testCopyCopiesFileProperly() { mkdir( static::$temp_dir . '/text' ); file_put_contents( static::$temp_dir . '/text/foo.txt', $data ); $filesystem->copy( static::$temp_dir . '/text/foo.txt', static::$temp_dir . '/text/foo2.txt' ); - Assert::assertFileExists( static::$temp_dir . '/text/foo2.txt' ); - Assert::assertEquals( $data, file_get_contents( static::$temp_dir . '/text/foo2.txt' ) ); + $this->assertFileExists( static::$temp_dir . '/text/foo2.txt' ); + $this->assertEquals( $data, file_get_contents( static::$temp_dir . '/text/foo2.txt' ) ); } public function testIsFileChecksFilesProperly() { $filesystem = new Filesystem(); mkdir( static::$temp_dir . '/help' ); file_put_contents( static::$temp_dir . '/help/foo.txt', 'contents' ); - Assert::assertTrue( $filesystem->is_file( static::$temp_dir . '/help/foo.txt' ) ); - Assert::assertFalse( $filesystem->is_file( static::$temp_dir . './help' ) ); + $this->assertTrue( $filesystem->is_file( static::$temp_dir . '/help/foo.txt' ) ); + $this->assertFalse( $filesystem->is_file( static::$temp_dir . './help' ) ); } public function testFilesMethodReturnsFileInfoObjects() { @@ -453,7 +453,7 @@ public function testFilesMethodReturnsFileInfoObjects() { file_put_contents( static::$temp_dir . '/objects/2.txt', '2' ); mkdir( static::$temp_dir . '/objects/bar' ); $files = new Filesystem(); - Assert::assertContainsOnlyInstancesOf( SplFileInfo::class, $files->files( static::$temp_dir . '/objects' ) ); + $this->assertContainsOnlyInstancesOf( SplFileInfo::class, $files->files( static::$temp_dir . '/objects' ) ); unset( $files ); } @@ -461,13 +461,13 @@ public function testAllFilesReturnsFileInfoObjects() { file_put_contents( static::$temp_dir . '/foo.txt', 'foo' ); file_put_contents( static::$temp_dir . '/bar.txt', 'bar' ); $files = new Filesystem(); - Assert::assertContainsOnlyInstancesOf( SplFileInfo::class, $files->all_files( static::$temp_dir ) ); + $this->assertContainsOnlyInstancesOf( SplFileInfo::class, $files->all_files( static::$temp_dir ) ); } public function testHash() { file_put_contents( static::$temp_dir . '/foo.txt', 'foo' ); $filesystem = new Filesystem(); - Assert::assertSame( 'acbd18db4cc2f85cedef654fccc4a4d8', $filesystem->hash( static::$temp_dir . '/foo.txt' ) ); + $this->assertSame( 'acbd18db4cc2f85cedef654fccc4a4d8', $filesystem->hash( static::$temp_dir . '/foo.txt' ) ); } public function test_guess_class_name() { diff --git a/tests/framework/test-alias-loader.php b/tests/framework/AliasLoaderTest.php similarity index 97% rename from tests/framework/test-alias-loader.php rename to tests/framework/AliasLoaderTest.php index f2c0596a..c108cb3c 100644 --- a/tests/framework/test-alias-loader.php +++ b/tests/framework/AliasLoaderTest.php @@ -5,7 +5,7 @@ use Mantle\Framework\Alias_Loader; use PHPUnit\Framework\TestCase; -class Test_Alias_Loader extends TestCase { +class AliasLoaderTest extends TestCase { protected function setUp(): void { parent::setUp(); diff --git a/tests/framework/test-application.php b/tests/framework/ApplicationTest.php similarity index 98% rename from tests/framework/test-application.php rename to tests/framework/ApplicationTest.php index b8f8c764..2a2260ef 100644 --- a/tests/framework/test-application.php +++ b/tests/framework/ApplicationTest.php @@ -7,7 +7,7 @@ use Symfony\Component\HttpKernel\Exception\HttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; -class Test_Application extends \Mockery\Adapter\Phpunit\MockeryTestCase { +class ApplicationTest extends \Mockery\Adapter\Phpunit\MockeryTestCase { protected function tearDown(): void { parent::tearDown(); diff --git a/tests/framework/test-bootloader.php b/tests/framework/BootloaderTest.php similarity index 98% rename from tests/framework/test-bootloader.php rename to tests/framework/BootloaderTest.php index c860405a..7855df92 100644 --- a/tests/framework/test-bootloader.php +++ b/tests/framework/BootloaderTest.php @@ -9,7 +9,7 @@ use Mantle\Testing\Concerns\Interacts_With_Hooks; use PHPUnit\Framework\TestCase; -class Test_Bootloader extends TestCase { +class BootloaderTest extends TestCase { use Interacts_With_Hooks; public function setUp(): void { diff --git a/tests/framework/test-isolated-framework.php b/tests/framework/IsolatedFrameworkTest.php similarity index 95% rename from tests/framework/test-isolated-framework.php rename to tests/framework/IsolatedFrameworkTest.php index ccda175a..67347330 100644 --- a/tests/framework/test-isolated-framework.php +++ b/tests/framework/IsolatedFrameworkTest.php @@ -11,7 +11,7 @@ * Designed to test the application in complete isolation for use outside of a * mantle-based application. */ -class Test_Isolated_Framework extends TestCase { +class IsolatedFrameworkTest extends TestCase { public Application $app; protected function setUp(): void { diff --git a/tests/framework/test-pipeline.php b/tests/framework/PipelineTest.php similarity index 99% rename from tests/framework/test-pipeline.php rename to tests/framework/PipelineTest.php index 05fd8523..9ce4d1ba 100644 --- a/tests/framework/test-pipeline.php +++ b/tests/framework/PipelineTest.php @@ -7,7 +7,7 @@ use PHPUnit\Framework\TestCase; use RuntimeException; -class Test_Pipeline extends TestCase { +class PipelineTest extends TestCase { public function testPipelineBasicUsage() { $pipeTwo = function ( $piped, $next ) { diff --git a/tests/framework/blocks/test-block-provider.php b/tests/framework/blocks/BlockProviderTest.php similarity index 97% rename from tests/framework/blocks/test-block-provider.php rename to tests/framework/blocks/BlockProviderTest.php index 72927f28..f547647e 100644 --- a/tests/framework/blocks/test-block-provider.php +++ b/tests/framework/blocks/BlockProviderTest.php @@ -10,7 +10,7 @@ use Mantle\Tests\Framework\Blocks\Fixtures\Dummy\Example_Block; use Mockery as m; -class Test_Block_Provider extends Framework_Test_Case { +class BlockProviderTest extends Framework_Test_Case { protected function setUp(): void { parent::setUp(); diff --git a/tests/framework/events/test-discover-events.php b/tests/framework/events/DiscoverEventsTest.php similarity index 97% rename from tests/framework/events/test-discover-events.php rename to tests/framework/events/DiscoverEventsTest.php index 5b477963..9840ee7b 100644 --- a/tests/framework/events/test-discover-events.php +++ b/tests/framework/events/DiscoverEventsTest.php @@ -10,7 +10,7 @@ use function Mantle\Support\Helpers\collect; -class Test_Discover_Events extends Framework_Test_Case { +class DiscoverEventsTest extends Framework_Test_Case { protected function setUp(): void { parent::setUp(); diff --git a/tests/framework/helpers/test-nullable-comment-objects-test-case.php b/tests/framework/helpers/NullableCommentObjectsTestCaseTest.php similarity index 92% rename from tests/framework/helpers/test-nullable-comment-objects-test-case.php rename to tests/framework/helpers/NullableCommentObjectsTestCaseTest.php index 80d160d3..da959488 100644 --- a/tests/framework/helpers/test-nullable-comment-objects-test-case.php +++ b/tests/framework/helpers/NullableCommentObjectsTestCaseTest.php @@ -14,7 +14,7 @@ /** * Unit tests for nullable comment object functions. */ -class Test_Nullable_Comment_Objects_Test_Case extends Framework_Test_Case { +class NullableCommentObjectsTestCaseTest extends Framework_Test_Case { /** * Test that `get_comment_object()` returns a comment object. */ diff --git a/tests/framework/helpers/test-nullable-post-objects-test-case.php b/tests/framework/helpers/NullablePostObjectsTestCaseTest.php similarity index 94% rename from tests/framework/helpers/test-nullable-post-objects-test-case.php rename to tests/framework/helpers/NullablePostObjectsTestCaseTest.php index b322a79f..c8178fc7 100644 --- a/tests/framework/helpers/test-nullable-post-objects-test-case.php +++ b/tests/framework/helpers/NullablePostObjectsTestCaseTest.php @@ -13,7 +13,7 @@ /** * Unit tests for nullable post object functions. */ -class Test_Nullable_Post_Objects_Test_Case extends Framework_Test_Case { +class NullablePostObjectsTestCaseTest extends Framework_Test_Case { /** * Test that `get_post_object()` returns a post object. */ diff --git a/tests/framework/helpers/NullableSiteObjectsTestCaseTest.php b/tests/framework/helpers/NullableSiteObjectsTestCaseTest.php new file mode 100644 index 00000000..ae2e5251 --- /dev/null +++ b/tests/framework/helpers/NullableSiteObjectsTestCaseTest.php @@ -0,0 +1,46 @@ +markTestSkipped( 'Multisite is not enabled.' ); + } + } + + /** + * Test that `get_site_object()` returns a site object. + */ + public function test_site_object_returns_site() { + $known_id = self::factory()->blog->create(); + + $found_object = get_site_object( $known_id ); + + $this->assertInstanceOf( \WP_Site::class, $found_object ); + + $this->assertSame( $known_id, (int) $found_object->blog_id ); + } + + /** + * Test that `get_site_object()` returns null when there is no site. + */ + public function test_site_object_returns_null() { + $found_object = get_site_object( -99 ); + + $this->assertNull( $found_object ); + } +} diff --git a/tests/framework/helpers/test-nullable-term-objects-test-case.php b/tests/framework/helpers/NullableTermObjectsTestCaseTest.php similarity index 97% rename from tests/framework/helpers/test-nullable-term-objects-test-case.php rename to tests/framework/helpers/NullableTermObjectsTestCaseTest.php index 17c4a7bf..f1834776 100644 --- a/tests/framework/helpers/test-nullable-term-objects-test-case.php +++ b/tests/framework/helpers/NullableTermObjectsTestCaseTest.php @@ -14,7 +14,7 @@ /** * Unit tests for nullable term object functions. */ -class Test_Nullable_Term_Objects_Test_Case extends Framework_Test_Case { +class NullableTermObjectsTestCaseTest extends Framework_Test_Case { /** * Test that `get_term_object()` returns a term object. */ diff --git a/tests/framework/helpers/test-nullable-user-objects-test-case.php b/tests/framework/helpers/NullableUserObjectsTestCaseTest.php similarity index 95% rename from tests/framework/helpers/test-nullable-user-objects-test-case.php rename to tests/framework/helpers/NullableUserObjectsTestCaseTest.php index 3916b52d..6ecaeb4b 100644 --- a/tests/framework/helpers/test-nullable-user-objects-test-case.php +++ b/tests/framework/helpers/NullableUserObjectsTestCaseTest.php @@ -14,7 +14,7 @@ /** * Unit tests for nullable user object functions. */ -class Test_Nullable_User_Objects_Test_Case extends Framework_Test_Case { +class NullableUserObjectsTestCaseTest extends Framework_Test_Case { /** * Test that `get_user_object()` returns a user object. */ diff --git a/tests/framework/helpers/test-nullable-site-objects-test-case.php b/tests/framework/helpers/test-nullable-site-objects-test-case.php deleted file mode 100644 index 6ff17ec6..00000000 --- a/tests/framework/helpers/test-nullable-site-objects-test-case.php +++ /dev/null @@ -1,40 +0,0 @@ -blog->create(); - - $found_object = get_site_object( $known_id ); - - $this->assertInstanceOf( \WP_Site::class, $found_object ); - - $this->assertSame( $known_id, (int) $found_object->blog_id ); - } - - /** - * Test that `get_site_object()` returns null when there is no site. - */ - public function test_site_object_returns_null() { - $found_object = get_site_object( -99 ); - - $this->assertNull( $found_object ); - } - } -} diff --git a/tests/helpers/test-helpers-array.php b/tests/helpers/HelpersArrayTest.php similarity index 99% rename from tests/helpers/test-helpers-array.php rename to tests/helpers/HelpersArrayTest.php index 400696b1..ffea296c 100644 --- a/tests/helpers/test-helpers-array.php +++ b/tests/helpers/HelpersArrayTest.php @@ -6,7 +6,7 @@ use function Mantle\Support\Helpers\data_set; use function Mantle\Support\Helpers\value; -class Test_Helpers_Array extends TestCase { +class HelpersArrayTest extends TestCase { public function testValue() { $this->assertSame( 'foo', value( 'foo' ) ); $this->assertSame( 'foo', value( function () { diff --git a/tests/helpers/test-helpers-general.php b/tests/helpers/HelpersGeneralTest.php similarity index 98% rename from tests/helpers/test-helpers-general.php rename to tests/helpers/HelpersGeneralTest.php index c189f83d..b010cb76 100644 --- a/tests/helpers/test-helpers-general.php +++ b/tests/helpers/HelpersGeneralTest.php @@ -19,7 +19,7 @@ use function Mantle\Support\Helpers\transform; use function Mantle\Support\Helpers\with; -class Test_Helpers_General extends TestCase { +class HelpersGeneralTest extends TestCase { public function testClassBasename() { $this->assertSame( 'Baz', class_basename( 'Foo\Bar\Baz' ) ); $this->assertSame( 'Baz', class_basename( 'Baz' ) ); @@ -178,7 +178,7 @@ public function testWith() { } ) ); } - public function providesPregReplaceArrayData() { + public static function providesPregReplaceArrayData() { $pointerArray = [ 'Taylor', 'Otwell' ]; next( $pointerArray ); diff --git a/tests/helpers/test-helpers.php b/tests/helpers/HelpersTest.php similarity index 98% rename from tests/helpers/test-helpers.php rename to tests/helpers/HelpersTest.php index 69d9dca0..72fd9e52 100644 --- a/tests/helpers/test-helpers.php +++ b/tests/helpers/HelpersTest.php @@ -15,7 +15,7 @@ use function Mantle\Support\Helpers\is_local_env; use function Mantle\Support\Helpers\logger; -class Test_Helpers extends TestCase { +class HelpersTest extends TestCase { protected Application $app; protected Log_Manager $instance; protected TestHandler $handler; diff --git a/tests/http-client/test-http-client.php b/tests/http-client/HttpClientTest.php similarity index 99% rename from tests/http-client/test-http-client.php rename to tests/http-client/HttpClientTest.php index 9a2642ce..3a3cd9bb 100644 --- a/tests/http-client/test-http-client.php +++ b/tests/http-client/HttpClientTest.php @@ -18,7 +18,7 @@ use Mantle\Testing\Framework_Test_Case; use Mantle\Testing\Mock_Http_Response; -class Test_Http_Client extends Framework_Test_Case { +class HttpClientTest extends Framework_Test_Case { protected Factory $http_factory; protected function setUp(): void { diff --git a/tests/http/test-controller.php b/tests/http/ControllerTest.php similarity index 97% rename from tests/http/test-controller.php rename to tests/http/ControllerTest.php index 12b8112c..9a48bfeb 100644 --- a/tests/http/test-controller.php +++ b/tests/http/ControllerTest.php @@ -13,7 +13,7 @@ use Mantle\Http\Request; use Mantle\Testing\Framework_Test_Case; -class Test_Controller extends Framework_Test_Case { +class ControllerTest extends Framework_Test_Case { public function test_controller_at_method() { Route::get( '/example-controller-at-route', Example_Controller::class . '@example_method' ); diff --git a/tests/http/test-redirector.php b/tests/http/RedirectorTest.php similarity index 98% rename from tests/http/test-redirector.php rename to tests/http/RedirectorTest.php index 6309b8ed..cbe063e1 100644 --- a/tests/http/test-redirector.php +++ b/tests/http/RedirectorTest.php @@ -14,7 +14,7 @@ use Symfony\Component\HttpFoundation\HeaderBag; use Symfony\Component\HttpFoundation\RedirectResponse; -class Test_Redirector extends \Mockery\Adapter\Phpunit\MockeryTestCase { +class RedirectorTest extends \Mockery\Adapter\Phpunit\MockeryTestCase { /** * @var Request diff --git a/tests/http/test-response-factory.php b/tests/http/ResponseFactoryTest.php similarity index 93% rename from tests/http/test-response-factory.php rename to tests/http/ResponseFactoryTest.php index b036e1e0..7d3f73a2 100644 --- a/tests/http/test-response-factory.php +++ b/tests/http/ResponseFactoryTest.php @@ -9,7 +9,7 @@ use Mantle\Http\Request; -class Test_Response_Factory extends \Mockery\Adapter\Phpunit\MockeryTestCase { +class ResponseFactoryTest extends \Mockery\Adapter\Phpunit\MockeryTestCase { public function setUp(): void { parent::setUp(); diff --git a/tests/http/test-router.php b/tests/http/RouterTest.php similarity index 99% rename from tests/http/test-router.php rename to tests/http/RouterTest.php index 54634ba5..c7600bb3 100644 --- a/tests/http/test-router.php +++ b/tests/http/RouterTest.php @@ -10,7 +10,7 @@ use Mantle\Http\Routing\Router; use Mantle\Testing\Framework_Test_Case; -class Test_Router extends Framework_Test_Case { +class RouterTest extends Framework_Test_Case { public function test_basic_dispatching() { $router = $this->get_router(); $router->get( diff --git a/tests/http/test-uploaded-file.php b/tests/http/UploadedFileTest.php similarity index 94% rename from tests/http/test-uploaded-file.php rename to tests/http/UploadedFileTest.php index 16659197..07931b70 100644 --- a/tests/http/test-uploaded-file.php +++ b/tests/http/UploadedFileTest.php @@ -6,7 +6,7 @@ use Mantle\Http\Uploaded_File; use Mantle\Testing\Framework_Test_Case; -class Test_Uploaded_File extends Framework_Test_Case { +class UploadedFileTest extends Framework_Test_Case { public function testUploadedFileCanRetrieveContentsFromTextFile() { $file = new Uploaded_File( diff --git a/tests/http/test-url-generator.php b/tests/http/UrlGeneratorTest.php similarity index 98% rename from tests/http/test-url-generator.php rename to tests/http/UrlGeneratorTest.php index 3c993700..76ede318 100644 --- a/tests/http/test-url-generator.php +++ b/tests/http/UrlGeneratorTest.php @@ -11,7 +11,7 @@ use Mantle\Http\Routing\Url_Generator; use Mantle\Testing\Framework_Test_Case; -class Test_Url_Generator extends Framework_Test_Case { +class UrlGeneratorTest extends Framework_Test_Case { protected Router $router; protected Url_Generator $url; diff --git a/tests/http/routing/test-post-model-routing.php b/tests/http/routing/PostModelRoutingTest.php similarity index 97% rename from tests/http/routing/test-post-model-routing.php rename to tests/http/routing/PostModelRoutingTest.php index 35cf7c2d..01b29443 100644 --- a/tests/http/routing/test-post-model-routing.php +++ b/tests/http/routing/PostModelRoutingTest.php @@ -11,7 +11,7 @@ use Mantle\Http\Routing\Middleware\Wrap_Template; use Mantle\Testing\Framework_Test_Case; -class Test_Post_Model_Routing extends Framework_Test_Case { +class PostModelRoutingTest extends Framework_Test_Case { protected function setUp(): void { parent::setUp(); diff --git a/tests/http/routing/test-rest-api-routing.php b/tests/http/routing/RestApiRoutingTest.php similarity index 98% rename from tests/http/routing/test-rest-api-routing.php rename to tests/http/routing/RestApiRoutingTest.php index ffcabb3e..fcae6ab1 100644 --- a/tests/http/routing/test-rest-api-routing.php +++ b/tests/http/routing/RestApiRoutingTest.php @@ -9,7 +9,7 @@ use Mantle\Testing\Framework_Test_Case; use WP_REST_Request; -class Test_REST_API_Routing extends Framework_Test_Case { +class RestApiRoutingTest extends Framework_Test_Case { use Refresh_Database; public function test_generic_route() { diff --git a/tests/http/routing/test-term-model-routing.php b/tests/http/routing/TermModelRoutingTest.php similarity index 98% rename from tests/http/routing/test-term-model-routing.php rename to tests/http/routing/TermModelRoutingTest.php index 2d880034..af327a47 100644 --- a/tests/http/routing/test-term-model-routing.php +++ b/tests/http/routing/TermModelRoutingTest.php @@ -14,7 +14,7 @@ use Mantle\Http\Routing\Middleware\Wrap_Template; use Mantle\Testing\Framework_Test_Case; -class Test_Term_Model_Routing extends Framework_Test_Case { +class TermModelRoutingTest extends Framework_Test_Case { public function test_category_term() { Testable_Category_Model::boot_if_not_booted(); diff --git a/tests/log/test-log-manager.php b/tests/log/LogManagerTest.php similarity index 97% rename from tests/log/test-log-manager.php rename to tests/log/LogManagerTest.php index bad4cf3d..4d4bc4f2 100644 --- a/tests/log/test-log-manager.php +++ b/tests/log/LogManagerTest.php @@ -8,7 +8,7 @@ use Mantle\Log\Log_Manager; use Monolog\Handler\TestHandler; -class Test_Log_Manager extends \Mockery\Adapter\Phpunit\MockeryTestCase { +class LogManagerTest extends \Mockery\Adapter\Phpunit\MockeryTestCase { /** * @var Application diff --git a/tests/queue/test-dispatcher.php b/tests/queue/DispatcherTest.php similarity index 96% rename from tests/queue/test-dispatcher.php rename to tests/queue/DispatcherTest.php index 2d8d5a91..745193b2 100644 --- a/tests/queue/test-dispatcher.php +++ b/tests/queue/DispatcherTest.php @@ -16,7 +16,7 @@ /** * @group queue */ -class Test_Dispatcher extends \Mockery\Adapter\Phpunit\MockeryTestCase { +class DispatcherTest extends \Mockery\Adapter\Phpunit\MockeryTestCase { /** * Provider instance. * diff --git a/tests/queue/test-queue-manager.php b/tests/queue/QueueManagerTest.php similarity index 94% rename from tests/queue/test-queue-manager.php rename to tests/queue/QueueManagerTest.php index 9eab6995..6975357a 100644 --- a/tests/queue/test-queue-manager.php +++ b/tests/queue/QueueManagerTest.php @@ -10,7 +10,7 @@ /** * @group queue */ -class Test_Queue_Manager extends \Mockery\Adapter\Phpunit\MockeryTestCase { +class QueueManagerTest extends \Mockery\Adapter\Phpunit\MockeryTestCase { public function test_default_connection() { $provider = m::mock( Provider::class ); diff --git a/tests/queue/test-worker.php b/tests/queue/WorkerTest.php similarity index 98% rename from tests/queue/test-worker.php rename to tests/queue/WorkerTest.php index 909c9970..1d5d426f 100644 --- a/tests/queue/test-worker.php +++ b/tests/queue/WorkerTest.php @@ -18,7 +18,7 @@ /** * @group queue */ -class Test_Worker extends MockeryTestCase { +class WorkerTest extends MockeryTestCase { /** * Application instance. diff --git a/tests/queue/providers/test-wordpress-cron-queue.php b/tests/queue/providers/WordPressCronQueueTest.php similarity index 98% rename from tests/queue/providers/test-wordpress-cron-queue.php rename to tests/queue/providers/WordPressCronQueueTest.php index 93fa00d4..9676ccf8 100644 --- a/tests/queue/providers/test-wordpress-cron-queue.php +++ b/tests/queue/providers/WordPressCronQueueTest.php @@ -21,7 +21,7 @@ * @group queue * @group wordpress-queue */ -class Test_WordPress_Cron_Queue extends Framework_Test_Case { +class WordPressCronQueueTest extends Framework_Test_Case { use Refresh_Database; protected function setUp(): void { diff --git a/tests/scheduling/test-event.php b/tests/scheduling/EventTest.php similarity index 97% rename from tests/scheduling/test-event.php rename to tests/scheduling/EventTest.php index 15163e9d..9a949020 100644 --- a/tests/scheduling/test-event.php +++ b/tests/scheduling/EventTest.php @@ -8,7 +8,7 @@ use Mantle\Testing\Mock_Http_Response; use Mockery as m; -class Test_Event extends Framework_Test_Case { +class EventTest extends Framework_Test_Case { protected function tearDown(): void { parent::tearDown(); diff --git a/tests/scheduling/test-frequency.php b/tests/scheduling/FrequencyTest.php similarity index 98% rename from tests/scheduling/test-frequency.php rename to tests/scheduling/FrequencyTest.php index 4dbc3c0a..172adf57 100644 --- a/tests/scheduling/test-frequency.php +++ b/tests/scheduling/FrequencyTest.php @@ -6,7 +6,7 @@ use Mantle\Testing\Framework_Test_Case; use Mockery as m; -class Test_Frequency extends Framework_Test_Case { +class FrequencyTest extends Framework_Test_Case { /* * @var Event diff --git a/tests/support/test-arr.php b/tests/support/ArrTest.php similarity index 99% rename from tests/support/test-arr.php rename to tests/support/ArrTest.php index 8cdd7521..b0b2b092 100644 --- a/tests/support/test-arr.php +++ b/tests/support/ArrTest.php @@ -10,7 +10,7 @@ use PHPUnit\Framework\TestCase; use stdClass; -class Test_Arr extends TestCase { +class ArrTest extends TestCase { public function testAccessible() { $this->assertTrue( Arr::accessible( [] ) ); diff --git a/tests/support/test-collection.php b/tests/support/CollectionTest.php similarity index 99% rename from tests/support/test-collection.php rename to tests/support/CollectionTest.php index 1db26c81..7fbd6a57 100644 --- a/tests/support/test-collection.php +++ b/tests/support/CollectionTest.php @@ -21,7 +21,7 @@ use function Mantle\Support\Helpers\collect; -class Test_Collection extends Framework_Test_Case { +class CollectionTest extends Framework_Test_Case { /** * @dataProvider collectionClassProvider */ @@ -4336,7 +4336,7 @@ public function test_from_fallback( $collection ) { * * @return array */ - public function collectionClassProvider() + public static function collectionClassProvider() { return [ [Collection::class], diff --git a/tests/support/test-environment.php b/tests/support/EnvironmentTest.php similarity index 94% rename from tests/support/test-environment.php rename to tests/support/EnvironmentTest.php index 1afb034f..04379194 100644 --- a/tests/support/test-environment.php +++ b/tests/support/EnvironmentTest.php @@ -5,7 +5,7 @@ use Mantle\Support\Environment; use Mantle\Testing\Framework_Test_Case; -class Test_Environment extends Framework_Test_Case { +class EnvironmentTest extends Framework_Test_Case { protected function setUp(): void { parent::setUp(); Environment::clear(); diff --git a/tests/support/test-forward-calls.php b/tests/support/ForwardCallsTest.php similarity index 98% rename from tests/support/test-forward-calls.php rename to tests/support/ForwardCallsTest.php index 39aa78bb..ee7d6094 100644 --- a/tests/support/test-forward-calls.php +++ b/tests/support/ForwardCallsTest.php @@ -7,7 +7,7 @@ use Mantle\Support\Forward_Calls; use PHPUnit\Framework\TestCase; -class Test_Forward_Calls extends TestCase { +class ForwardCallsTest extends TestCase { public function testForward_Calls() { $results = ( new Forward_CallsOne() )->forwardedTwo( 'foo', 'bar' ); diff --git a/tests/support/test-pluralizer.php b/tests/support/PluralizerTest.php similarity index 99% rename from tests/support/test-pluralizer.php rename to tests/support/PluralizerTest.php index 78c6fbfa..787bb1b0 100755 --- a/tests/support/test-pluralizer.php +++ b/tests/support/PluralizerTest.php @@ -5,7 +5,7 @@ use Mantle\Support\Str; use PHPUnit\Framework\TestCase; -class Test_Pluralizer extends TestCase { +class PluralizerTest extends TestCase { public function testBasicSingular() { $this->assertSame( 'child', Str::singular( 'children' ) ); diff --git a/tests/support/test-service-provider.php b/tests/support/ServiceProviderTest.php similarity index 99% rename from tests/support/test-service-provider.php rename to tests/support/ServiceProviderTest.php index 8b42d9c8..9b325be6 100644 --- a/tests/support/test-service-provider.php +++ b/tests/support/ServiceProviderTest.php @@ -9,7 +9,7 @@ use Mantle\Support\Attributes\Action; use Mockery as m; -class Test_Service_Provider extends \Mockery\Adapter\Phpunit\MockeryTestCase { +class ServiceProviderTest extends \Mockery\Adapter\Phpunit\MockeryTestCase { protected function setUp(): void { parent::setUp(); diff --git a/tests/support/test-str.php b/tests/support/StrTest.php similarity index 99% rename from tests/support/test-str.php rename to tests/support/StrTest.php index d0349f5b..2fd1b1d4 100644 --- a/tests/support/test-str.php +++ b/tests/support/StrTest.php @@ -8,7 +8,7 @@ use Ramsey\Uuid\UuidInterface; use ReflectionClass; -class Test_Str extends TestCase { +class StrTest extends TestCase { public function testStringCanBeLimitedByWords() { $this->assertSame( 'Taylor...', Str::words( 'Taylor Otwell', 1 ) ); diff --git a/tests/support/test-stringable.php b/tests/support/StringableTest.php similarity index 99% rename from tests/support/test-stringable.php rename to tests/support/StringableTest.php index e50565c1..98e9c4e2 100644 --- a/tests/support/test-stringable.php +++ b/tests/support/StringableTest.php @@ -8,7 +8,7 @@ use Mantle\Support\Stringable; use PHPUnit\Framework\TestCase; -class Test_Stringable extends TestCase { +class StringableTest extends TestCase { /** * @param string $string diff --git a/tests/support/providers/test-model-register-provider.php b/tests/support/providers/ModelRegisterProviderTest.php similarity index 94% rename from tests/support/providers/test-model-register-provider.php rename to tests/support/providers/ModelRegisterProviderTest.php index 68db9ab1..163be978 100644 --- a/tests/support/providers/test-model-register-provider.php +++ b/tests/support/providers/ModelRegisterProviderTest.php @@ -11,7 +11,7 @@ use Mockery as m; use Mockery\Adapter\Phpunit\MockeryTestCase; -class Test_Model_Register_Provider extends MockeryTestCase { +class ModelRegisterProviderTest extends MockeryTestCase { protected function setUp(): void { parent::setUp(); remove_all_actions( 'init' ); diff --git a/tests/testing/test-core-test-shim.php b/tests/testing/CoreTestShimTest.php similarity index 88% rename from tests/testing/test-core-test-shim.php rename to tests/testing/CoreTestShimTest.php index d5f00950..f88ffe97 100644 --- a/tests/testing/test-core-test-shim.php +++ b/tests/testing/CoreTestShimTest.php @@ -3,7 +3,7 @@ use WP_UnitTestCase; -class Test_Core_Test_Shim extends WP_UnitTestCase { +class CoreTestShimTest extends WP_UnitTestCase { protected $setup_called = false; public function set_up() { diff --git a/tests/testing/test-permalink-structure.php b/tests/testing/PermalinkStructureTest.php similarity index 97% rename from tests/testing/test-permalink-structure.php rename to tests/testing/PermalinkStructureTest.php index 0d7e114f..71306135 100644 --- a/tests/testing/test-permalink-structure.php +++ b/tests/testing/PermalinkStructureTest.php @@ -4,7 +4,7 @@ use Mantle\Testing\Framework_Test_Case; use Mantle\Testing\Utils; -class Test_Permalink_Structure extends Framework_Test_Case { +class PermalinkStructureTest extends Framework_Test_Case { protected function setUp(): void { parent::setUp(); diff --git a/tests/testing/test-with-faker.php b/tests/testing/WithFakerTest.php similarity index 70% rename from tests/testing/test-with-faker.php rename to tests/testing/WithFakerTest.php index 8c11cfac..8b950906 100644 --- a/tests/testing/test-with-faker.php +++ b/tests/testing/WithFakerTest.php @@ -3,8 +3,9 @@ use Faker\Generator; use Mantle\Testing\Concerns\With_Faker; +use Mantle\Testing\Framework_Test_Case; -class Test_With_Faker extends Framework_Test_Case { +class WithFakerTest extends Framework_Test_Case { use With_Faker; public function test_creates_faker() { diff --git a/tests/testing/concerns/test-block-assertions.php b/tests/testing/concerns/BlockAssertionsTest.php similarity index 95% rename from tests/testing/concerns/test-block-assertions.php rename to tests/testing/concerns/BlockAssertionsTest.php index 97a8805a..dbd157a3 100644 --- a/tests/testing/concerns/test-block-assertions.php +++ b/tests/testing/concerns/BlockAssertionsTest.php @@ -8,7 +8,7 @@ /** * @group testing */ -class Test_Block_Assertions extends Framework_Test_Case { +class BlockAssertionsTest extends Framework_Test_Case { use With_Faker; protected WP_Post $post; diff --git a/tests/testing/concerns/test-deprecations.php b/tests/testing/concerns/DeprecationsTest.php similarity index 96% rename from tests/testing/concerns/test-deprecations.php rename to tests/testing/concerns/DeprecationsTest.php index 44298b51..fc09d842 100644 --- a/tests/testing/concerns/test-deprecations.php +++ b/tests/testing/concerns/DeprecationsTest.php @@ -8,7 +8,7 @@ * * @group testing */ -class Test_Deprecations extends Framework_Test_Case { +class DeprecationsTest extends Framework_Test_Case { /** * @expectedDeprecated test_deprecation_annotation */ diff --git a/tests/testing/concerns/test-element-assertions.php b/tests/testing/concerns/ElementAssertionsTest.php similarity index 96% rename from tests/testing/concerns/test-element-assertions.php rename to tests/testing/concerns/ElementAssertionsTest.php index deda4c49..4c55dedb 100644 --- a/tests/testing/concerns/test-element-assertions.php +++ b/tests/testing/concerns/ElementAssertionsTest.php @@ -7,7 +7,7 @@ /** * @group testing */ -class Test_Element_Assertions extends Framework_Test_Case { +class ElementAssertionsTest extends Framework_Test_Case { public string $test_content = '
Example Section
diff --git a/tests/testing/concerns/test-incorrect-usage.php b/tests/testing/concerns/IncorrectUsageTest.php similarity index 96% rename from tests/testing/concerns/test-incorrect-usage.php rename to tests/testing/concerns/IncorrectUsageTest.php index 214f7821..156701de 100644 --- a/tests/testing/concerns/test-incorrect-usage.php +++ b/tests/testing/concerns/IncorrectUsageTest.php @@ -8,7 +8,7 @@ * * @group testing */ -class Test_Incorrect_Usage extends Framework_Test_Case { +class IncorrectUsageTest extends Framework_Test_Case { /** * @expectedIncorrectUsage test_incorrect_usage_annotation */ diff --git a/tests/testing/concerns/test-interacts-with-console.php b/tests/testing/concerns/InteractsWithConsoleTest.php similarity index 95% rename from tests/testing/concerns/test-interacts-with-console.php rename to tests/testing/concerns/InteractsWithConsoleTest.php index 10bfeb56..d19a1796 100644 --- a/tests/testing/concerns/test-interacts-with-console.php +++ b/tests/testing/concerns/InteractsWithConsoleTest.php @@ -7,7 +7,7 @@ /** * @group testing */ -class Test_Interacts_With_Console extends Framework_Test_Case { +class InteractsWithConsoleTest extends Framework_Test_Case { protected function setUp(): void { parent::setUp(); diff --git a/tests/testing/concerns/test-interacts-with-external-requests.php b/tests/testing/concerns/InteractsWithExternalRequestsTest.php similarity index 99% rename from tests/testing/concerns/test-interacts-with-external-requests.php rename to tests/testing/concerns/InteractsWithExternalRequestsTest.php index fb655fc7..44b4863d 100644 --- a/tests/testing/concerns/test-interacts-with-external-requests.php +++ b/tests/testing/concerns/InteractsWithExternalRequestsTest.php @@ -17,7 +17,7 @@ * * @group testing */ -class Test_Interacts_With_External_Requests extends Framework_Test_Case { +class InteractsWithExternalRequestsTest extends Framework_Test_Case { use Prevent_Remote_Requests; public function test_fake_request() { diff --git a/tests/testing/concerns/test-interacts-with-hooks.php b/tests/testing/concerns/InteractsWithHooksTest.php similarity index 98% rename from tests/testing/concerns/test-interacts-with-hooks.php rename to tests/testing/concerns/InteractsWithHooksTest.php index 2447a3fc..bdf435cd 100644 --- a/tests/testing/concerns/test-interacts-with-hooks.php +++ b/tests/testing/concerns/InteractsWithHooksTest.php @@ -6,7 +6,7 @@ /** * @group testing */ -class Test_Interacts_With_Hooks extends Framework_Test_Case { +class InteractsWithHooksTest extends Framework_Test_Case { public function test_hook_applied() { $this->assertHookNotApplied( 'hook_to_check' ); $this->assertHookNotApplied( 'filter_to_check' ); diff --git a/tests/testing/concerns/test-makes-http-requests.php b/tests/testing/concerns/MakesHttpRequestsTest.php similarity index 99% rename from tests/testing/concerns/test-makes-http-requests.php rename to tests/testing/concerns/MakesHttpRequestsTest.php index 1afd1fc4..5dc1b83e 100644 --- a/tests/testing/concerns/test-makes-http-requests.php +++ b/tests/testing/concerns/MakesHttpRequestsTest.php @@ -17,7 +17,7 @@ /** * @group testing */ -class Test_Makes_Http_Requests extends Framework_Test_Case { +class MakesHttpRequestsTest extends Framework_Test_Case { use Refresh_Database; public function test_get_home() { diff --git a/tests/testing/concerns/test-wordpress-authentication.php b/tests/testing/concerns/WordPressAuthenticationTest.php similarity index 93% rename from tests/testing/concerns/test-wordpress-authentication.php rename to tests/testing/concerns/WordPressAuthenticationTest.php index ed6af32e..252035ec 100644 --- a/tests/testing/concerns/test-wordpress-authentication.php +++ b/tests/testing/concerns/WordPressAuthenticationTest.php @@ -8,7 +8,7 @@ /** * @group testing */ -class Test_WordPress_Authentication extends Framework_Test_Case { +class WordPressAuthenticationTest extends Framework_Test_Case { public function test_acting_as_role() { $user = $this->acting_as( 'administrator' ); diff --git a/tests/testing/concerns/__snapshots__/MakesHttpRequestsTest__test_match_snapshot__1.yml b/tests/testing/concerns/__snapshots__/MakesHttpRequestsTest__test_match_snapshot__1.yml new file mode 100644 index 00000000..a0cd6f38 --- /dev/null +++ b/tests/testing/concerns/__snapshots__/MakesHttpRequestsTest__test_match_snapshot__1.yml @@ -0,0 +1,3 @@ +- 1 +- 2 +- 3 diff --git a/tests/testing/concerns/__snapshots__/MakesHttpRequestsTest__test_match_snapshot_http__1.html b/tests/testing/concerns/__snapshots__/MakesHttpRequestsTest__test_match_snapshot_http__1.html new file mode 100644 index 00000000..1b9e0726 --- /dev/null +++ b/tests/testing/concerns/__snapshots__/MakesHttpRequestsTest__test_match_snapshot_http__1.html @@ -0,0 +1 @@ +

example

diff --git a/tests/testing/concerns/__snapshots__/MakesHttpRequestsTest__test_match_snapshot_http_partial__1.html b/tests/testing/concerns/__snapshots__/MakesHttpRequestsTest__test_match_snapshot_http_partial__1.html new file mode 100644 index 00000000..653788ff --- /dev/null +++ b/tests/testing/concerns/__snapshots__/MakesHttpRequestsTest__test_match_snapshot_http_partial__1.html @@ -0,0 +1,6 @@ +
+

Example

+
+

Example two

+
+
diff --git a/tests/testing/concerns/__snapshots__/MakesHttpRequestsTest__test_match_snapshot_rest__1.json b/tests/testing/concerns/__snapshots__/MakesHttpRequestsTest__test_match_snapshot_rest__1.json new file mode 100644 index 00000000..3e2ca0ff --- /dev/null +++ b/tests/testing/concerns/__snapshots__/MakesHttpRequestsTest__test_match_snapshot_rest__1.json @@ -0,0 +1,3 @@ +{ + "key": "value here" +} diff --git a/tests/testing/concerns/__snapshots__/MakesHttpRequestsTest__test_match_snapshot_rest__2.json b/tests/testing/concerns/__snapshots__/MakesHttpRequestsTest__test_match_snapshot_rest__2.json new file mode 100644 index 00000000..ffdede42 --- /dev/null +++ b/tests/testing/concerns/__snapshots__/MakesHttpRequestsTest__test_match_snapshot_rest__2.json @@ -0,0 +1,3 @@ +{ + "type": "post" +} diff --git a/tests/testing/concerns/__snapshots__/MakesHttpRequestsTest__test_match_snapshot_rest__3.json b/tests/testing/concerns/__snapshots__/MakesHttpRequestsTest__test_match_snapshot_rest__3.json new file mode 100644 index 00000000..347a5ba5 --- /dev/null +++ b/tests/testing/concerns/__snapshots__/MakesHttpRequestsTest__test_match_snapshot_rest__3.json @@ -0,0 +1,26 @@ +{ + "*.type": [ + "post", + "post", + "post", + "post", + "post", + "post", + "post", + "post", + "post", + "post" + ], + "*.status": [ + "publish", + "publish", + "publish", + "publish", + "publish", + "publish", + "publish", + "publish", + "publish", + "publish" + ] +} diff --git a/tests/testing/concerns/__snapshots__/MakesHttpRequestsTest__test_multiple_requests__1.yml b/tests/testing/concerns/__snapshots__/MakesHttpRequestsTest__test_multiple_requests__1.yml new file mode 100644 index 00000000..a0cd6f38 --- /dev/null +++ b/tests/testing/concerns/__snapshots__/MakesHttpRequestsTest__test_multiple_requests__1.yml @@ -0,0 +1,3 @@ +- 1 +- 2 +- 3 diff --git a/tests/testkit/test-testkit-install-wordpress.php b/tests/testkit/TestkitInstallWordPressTest.php similarity index 92% rename from tests/testkit/test-testkit-install-wordpress.php rename to tests/testkit/TestkitInstallWordPressTest.php index 80bdf940..0177366a 100644 --- a/tests/testkit/test-testkit-install-wordpress.php +++ b/tests/testkit/TestkitInstallWordPressTest.php @@ -14,7 +14,7 @@ $_SERVER['__mantle_after_wordpress_install']++; } ); -class Test_Testkit_Install_WordPress extends Test_Case { +class TestkitInstallWordPressTest extends Test_Case { use Installs_WordPress; public function test_mantle_is_installed_from_trait() { diff --git a/tests/testkit/test-testkit-test-case.php b/tests/testkit/TestkitTestCaseTest.php similarity index 87% rename from tests/testkit/test-testkit-test-case.php rename to tests/testkit/TestkitTestCaseTest.php index 25d71d86..895181be 100644 --- a/tests/testkit/test-testkit-test-case.php +++ b/tests/testkit/TestkitTestCaseTest.php @@ -1,11 +1,11 @@ assertInstanceOf( \Mantle\Contracts\Application::class, $this->create_application() ); diff --git a/tests/testkit/test-with-faker.php b/tests/testkit/WithFakerTest.php similarity index 85% rename from tests/testkit/test-with-faker.php rename to tests/testkit/WithFakerTest.php index 12ec2efb..05bc615e 100644 --- a/tests/testkit/test-with-faker.php +++ b/tests/testkit/WithFakerTest.php @@ -5,7 +5,7 @@ use Mantle\Testing\Concerns\With_Faker; use Mantle\Testkit\Test_Case; -class Test_With_Faker extends Test_Case { +class WithFakerTest extends Test_Case { use With_Faker; public function test_creates_faker() { diff --git a/tests/testkit/concerns/trait-example-overload.php b/tests/testkit/concerns/ExampleOverload.php similarity index 83% rename from tests/testkit/concerns/trait-example-overload.php rename to tests/testkit/concerns/ExampleOverload.php index 25f914d3..ac79ce02 100644 --- a/tests/testkit/concerns/trait-example-overload.php +++ b/tests/testkit/concerns/ExampleOverload.php @@ -10,7 +10,7 @@ /** * Validates that method overloading is working as expected. */ -trait Example_Overload { +trait ExampleOverload { /** * @var array Contains the names of the methods that have been overloaded. @@ -21,7 +21,7 @@ trait Example_Overload { * This method should be run during the setUpBeforeClass method of * the Test_Case. */ - public static function example_overload_set_up_before_class(): void { + public static function exampleoverload_set_up_before_class(): void { static::$overloaded_methods[] = 'setUpBeforeClass'; } } diff --git a/tests/view/test-blade-views.php b/tests/view/BladeViewsTest.php similarity index 93% rename from tests/view/test-blade-views.php rename to tests/view/BladeViewsTest.php index 7794fdca..9334711f 100644 --- a/tests/view/test-blade-views.php +++ b/tests/view/BladeViewsTest.php @@ -3,7 +3,7 @@ use Mantle\Testing\Framework_Test_Case; -class Test_Blade_Views extends Framework_Test_Case { +class BladeViewsTest extends Framework_Test_Case { protected function setUp(): void { parent::setUp(); diff --git a/tests/view/test-file-engine.php b/tests/view/FileEngineTest.php similarity index 91% rename from tests/view/test-file-engine.php rename to tests/view/FileEngineTest.php index a7308140..e5b02393 100644 --- a/tests/view/test-file-engine.php +++ b/tests/view/FileEngineTest.php @@ -3,7 +3,7 @@ use Mantle\Testing\Framework_Test_Case; -class Test_File_Engine extends Framework_Test_Case { +class FileEngineTest extends Framework_Test_Case { protected function setUp(): void { parent::setUp(); diff --git a/tests/view/test-php-views.php b/tests/view/PhpViewsTest.php similarity index 99% rename from tests/view/test-php-views.php rename to tests/view/PhpViewsTest.php index 985855e2..9ee68f04 100644 --- a/tests/view/test-php-views.php +++ b/tests/view/PhpViewsTest.php @@ -5,7 +5,7 @@ use Mantle\Facade\View; use Mantle\Http\View\Factory; -class Test_Php_Views extends Framework_Test_Case { +class PhpViewsTest extends Framework_Test_Case { protected Factory $view_factory; protected function setUp(): void { diff --git a/tests/view/test-view-finder.php b/tests/view/ViewFinderTest.php similarity index 96% rename from tests/view/test-view-finder.php rename to tests/view/ViewFinderTest.php index e9b98954..655b0671 100644 --- a/tests/view/test-view-finder.php +++ b/tests/view/ViewFinderTest.php @@ -4,7 +4,7 @@ use Mantle\Facade\View_Loader; use Mantle\Testing\Framework_Test_Case; -class Test_View_Finder extends Framework_Test_Case { +class ViewFinderTest extends Framework_Test_Case { protected function setUp(): void { parent::setUp(); From 9c9b1a76e99c1756691669c35de743d3978b2c5c Mon Sep 17 00:00:00 2001 From: Sean Fisher Date: Fri, 17 Nov 2023 15:55:13 -0500 Subject: [PATCH 02/26] More changes --- tests/support/CollectionTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/support/CollectionTest.php b/tests/support/CollectionTest.php index 7fbd6a57..76079491 100644 --- a/tests/support/CollectionTest.php +++ b/tests/support/CollectionTest.php @@ -320,7 +320,7 @@ public function testJsonSerializeCallsToArrayOrJsonSerializeOnEachItemInCollecti */ public function testToJsonEncodesTheJsonSerializeResult($collection) { - $c = $this->getMockBuilder($collection)->setMethods(['jsonSerialize'])->getMock(); + $c = $this->getMockBuilder($collection)->onlyMethods(['jsonSerialize'])->getMock(); $c->expects($this->once())->method('jsonSerialize')->willReturn('foo'); $results = $c->to_json(); $this->assertJsonStringEqualsJsonString(json_encode('foo'), $results); @@ -331,7 +331,7 @@ public function testToJsonEncodesTheJsonSerializeResult($collection) */ public function testCastingToStringJsonEncodesTheToArrayResult($collection) { - $c = $this->getMockBuilder($collection)->setMethods(['jsonSerialize'])->getMock(); + $c = $this->getMockBuilder($collection)->onlyMethods(['jsonSerialize'])->getMock(); $c->expects($this->once())->method('jsonSerialize')->willReturn('foo'); $this->assertJsonStringEqualsJsonString(json_encode('foo'), (string) $c); From 5dabc55e531c668bc8682f8037b9a62796cd6ffb Mon Sep 17 00:00:00 2001 From: Sean Fisher Date: Fri, 17 Nov 2023 16:00:48 -0500 Subject: [PATCH 03/26] More changes for 10 and WP 6.4 --- tests/assets/AssetManagerTest.php | 13 ++++++------- tests/assets/TestCase.php | 1 + 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/assets/AssetManagerTest.php b/tests/assets/AssetManagerTest.php index 33f35175..43fb6f6b 100644 --- a/tests/assets/AssetManagerTest.php +++ b/tests/assets/AssetManagerTest.php @@ -22,7 +22,7 @@ public function test_register_script() { ); $this->assertStringContainsString( - "", + '', $this->get_wp_head(), ); } @@ -37,7 +37,7 @@ public function test_register_style() { ); $this->assertStringContainsString( - "", + '', $this->get_wp_head(), ); } @@ -53,7 +53,7 @@ public function test_async_script() { $manager->async( 'testsync-script-handle' ); $this->assertStringContainsString( - "", + '', $this->get_wp_head(), ); } @@ -66,7 +66,7 @@ public function test_fluent_script() { ->async(); $this->assertStringContainsString( - "", + '', $this->get_wp_head(), ); } @@ -78,7 +78,7 @@ public function test_fluent_script_helper() { ->async(); $this->assertStringContainsString( - "", + '', $this->get_wp_head(), ); } @@ -89,7 +89,6 @@ public function test_core_dependency() { // Prevent a failing test if this is removed in the future. if ( ! isset( $wp_scripts->registered['swfobject'] ) ) { $this->markTestSkipped( 'swfobject is not registered in core, should change the dependency tested against' ); - return; } $version = $wp_scripts->registered['swfobject']->ver; @@ -101,7 +100,7 @@ public function test_core_dependency() { ->async(); $this->assertStringContainsString( - "", + '', $this->get_wp_head(), ); } diff --git a/tests/assets/TestCase.php b/tests/assets/TestCase.php index 5006e4ed..0d2a7313 100644 --- a/tests/assets/TestCase.php +++ b/tests/assets/TestCase.php @@ -48,6 +48,7 @@ function() { protected function get_wp_head(): string { ob_start(); do_action( 'wp_head' ); + // do_action( 'wp_footer' ); return ob_get_clean(); } From 5344085455f2dd432b63c23bbaa3770cdb358bb2 Mon Sep 17 00:00:00 2001 From: Sean Fisher Date: Fri, 17 Nov 2023 16:14:35 -0500 Subject: [PATCH 04/26] Last changes for phpunit 10 --- tests/assets/AssetLoaderTest.php | 2 +- tests/bootstrap.php | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/assets/AssetLoaderTest.php b/tests/assets/AssetLoaderTest.php index a29d91a4..53b8c3d7 100644 --- a/tests/assets/AssetLoaderTest.php +++ b/tests/assets/AssetLoaderTest.php @@ -84,7 +84,7 @@ public function test_asset_enqueue_from_asset_path() { $head = $this->get_wp_head(); $this->assertStringContainsString( - "", + '', $head, ); diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 44c31d11..2686ddc4 100755 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -14,8 +14,6 @@ // Enable debugging flag for local development on the testing framework. // define( 'MANTLE_TESTING_DEBUG', true ); -require_once __DIR__ . '/../vendor/wordpress-autoload.php'; - \Mantle\Testing\manager() ->maybe_rsync_plugin() ->with_vip_mu_plugins() From f823f937ccff01849141aea861d07c854356a9e3 Mon Sep 17 00:00:00 2001 From: Sean Fisher Date: Fri, 17 Nov 2023 16:20:11 -0500 Subject: [PATCH 05/26] Bump asset manager --- composer.json | 2 +- src/mantle/assets/composer.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 8c23a2ec..107e0c5c 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "require": { "php": "^8.0", "alleyinteractive/composer-wordpress-autoloader": "^1.0", - "alleyinteractive/wp-asset-manager": "^1.3.3", + "alleyinteractive/wp-asset-manager": "^1.3.4", "alleyinteractive/wp-caper": "^2.0.1", "alleyinteractive/wp-concurrent-remote-requests": "^1.0.2", "alleyinteractive/wp-filter-side-effects": "^2.0", diff --git a/src/mantle/assets/composer.json b/src/mantle/assets/composer.json index 23467eb3..7ac86c95 100644 --- a/src/mantle/assets/composer.json +++ b/src/mantle/assets/composer.json @@ -5,7 +5,7 @@ "require": { "php": "^8.0", "alleyinteractive/composer-wordpress-autoloader": "^1.0", - "alleyinteractive/wp-asset-manager": "^1.3.3", + "alleyinteractive/wp-asset-manager": "^1.3.4", "mantle-framework/contracts": "^0.12", "mantle-framework/support": "^0.12" }, From 7c7dc4142f37e648eaa918703f601a5fb8e2481f Mon Sep 17 00:00:00 2001 From: Sean Fisher Date: Fri, 17 Nov 2023 16:41:23 -0500 Subject: [PATCH 06/26] Require the wp autoloader --- tests/bootstrap.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 2686ddc4..44c31d11 100755 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -14,6 +14,8 @@ // Enable debugging flag for local development on the testing framework. // define( 'MANTLE_TESTING_DEBUG', true ); +require_once __DIR__ . '/../vendor/wordpress-autoload.php'; + \Mantle\Testing\manager() ->maybe_rsync_plugin() ->with_vip_mu_plugins() From ad565f63fd52b0e8952059d7489a57587edee3c6 Mon Sep 17 00:00:00 2001 From: Sean Fisher Date: Fri, 17 Nov 2023 16:43:56 -0500 Subject: [PATCH 07/26] Require once the test case --- tests/assets/AssetLoaderTest.php | 2 ++ tests/assets/AssetManagerTest.php | 2 ++ 2 files changed, 4 insertions(+) diff --git a/tests/assets/AssetLoaderTest.php b/tests/assets/AssetLoaderTest.php index 53b8c3d7..50494cd6 100644 --- a/tests/assets/AssetLoaderTest.php +++ b/tests/assets/AssetLoaderTest.php @@ -5,6 +5,8 @@ use Mantle\Assets\Asset_Loader; use Mantle\Assets\Exception\Asset_Not_Found; +require_once __DIR__ . '/TestCase.php'; + class AssetLoaderTest extends TestCase { public string $build_dir = ''; diff --git a/tests/assets/AssetManagerTest.php b/tests/assets/AssetManagerTest.php index 43fb6f6b..9ad3b2f3 100644 --- a/tests/assets/AssetManagerTest.php +++ b/tests/assets/AssetManagerTest.php @@ -4,6 +4,8 @@ use Mantle\Assets\Asset_Manager; +require_once __DIR__ . '/TestCase.php'; + /** * @group assets */ From b8b7f0a1e0b4e7d18609f4c27e29f1a5d9cc8b9e Mon Sep 17 00:00:00 2001 From: Sean Fisher Date: Fri, 17 Nov 2023 16:46:21 -0500 Subject: [PATCH 08/26] Another adjust --- tests/assets/AssetLoaderTest.php | 2 -- tests/assets/AssetManagerTest.php | 2 -- tests/bootstrap.php | 2 +- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/tests/assets/AssetLoaderTest.php b/tests/assets/AssetLoaderTest.php index 50494cd6..53b8c3d7 100644 --- a/tests/assets/AssetLoaderTest.php +++ b/tests/assets/AssetLoaderTest.php @@ -5,8 +5,6 @@ use Mantle\Assets\Asset_Loader; use Mantle\Assets\Exception\Asset_Not_Found; -require_once __DIR__ . '/TestCase.php'; - class AssetLoaderTest extends TestCase { public string $build_dir = ''; diff --git a/tests/assets/AssetManagerTest.php b/tests/assets/AssetManagerTest.php index 9ad3b2f3..43fb6f6b 100644 --- a/tests/assets/AssetManagerTest.php +++ b/tests/assets/AssetManagerTest.php @@ -4,8 +4,6 @@ use Mantle\Assets\Asset_Manager; -require_once __DIR__ . '/TestCase.php'; - /** * @group assets */ diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 44c31d11..bcff0ff0 100755 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -14,7 +14,7 @@ // Enable debugging flag for local development on the testing framework. // define( 'MANTLE_TESTING_DEBUG', true ); -require_once __DIR__ . '/../vendor/wordpress-autoload.php'; +require_once __DIR__ . '/../vendor/autoload.php'; \Mantle\Testing\manager() ->maybe_rsync_plugin() From d2be9c661c5931bdf82b841337edc31d37e2f8a2 Mon Sep 17 00:00:00 2001 From: Sean Fisher Date: Fri, 17 Nov 2023 16:57:27 -0500 Subject: [PATCH 09/26] Enable debug --- tests/bootstrap.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/bootstrap.php b/tests/bootstrap.php index bcff0ff0..7bd8a61d 100755 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -12,7 +12,7 @@ define( 'MANTLE_PHPUNIT_TEMPLATE_PATH', __DIR__ . '/template-parts' ); // Enable debugging flag for local development on the testing framework. -// define( 'MANTLE_TESTING_DEBUG', true ); +define( 'MANTLE_TESTING_DEBUG', true ); require_once __DIR__ . '/../vendor/autoload.php'; From 06103d517c3cf67371ababd9c707dff3a16205fb Mon Sep 17 00:00:00 2001 From: Sean Fisher Date: Fri, 17 Nov 2023 17:03:12 -0500 Subject: [PATCH 10/26] Removing slash --- composer.json | 2 +- tests/bootstrap.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 107e0c5c..95e5fdd4 100644 --- a/composer.json +++ b/composer.json @@ -104,7 +104,7 @@ }, "autoload-dev": { "psr-4": { - "Mantle\\Tests\\": "tests/" + "Mantle\\Tests\\": "tests" } }, "config": { diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 7bd8a61d..bcff0ff0 100755 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -12,7 +12,7 @@ define( 'MANTLE_PHPUNIT_TEMPLATE_PATH', __DIR__ . '/template-parts' ); // Enable debugging flag for local development on the testing framework. -define( 'MANTLE_TESTING_DEBUG', true ); +// define( 'MANTLE_TESTING_DEBUG', true ); require_once __DIR__ . '/../vendor/autoload.php'; From 6506aa3c85abbe477f95e0c8a889edc4f55224bd Mon Sep 17 00:00:00 2001 From: Sean Fisher Date: Fri, 17 Nov 2023 17:03:55 -0500 Subject: [PATCH 11/26] Attempt to include in parent autoload --- composer.json | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 95e5fdd4..4cdf24cf 100644 --- a/composer.json +++ b/composer.json @@ -100,9 +100,7 @@ "src/mantle/queue/autoload.php", "src/mantle/support/autoload.php", "src/mantle/testing/autoload.php" - ] - }, - "autoload-dev": { + ], "psr-4": { "Mantle\\Tests\\": "tests" } From 09b9fbb43c395999a180c9c85847392673251012 Mon Sep 17 00:00:00 2001 From: Sean Fisher Date: Mon, 20 Nov 2023 08:58:06 -0500 Subject: [PATCH 12/26] Revert "Attempt to include in parent autoload" This reverts commit 6506aa3c85abbe477f95e0c8a889edc4f55224bd. --- composer.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 4cdf24cf..95e5fdd4 100644 --- a/composer.json +++ b/composer.json @@ -100,7 +100,9 @@ "src/mantle/queue/autoload.php", "src/mantle/support/autoload.php", "src/mantle/testing/autoload.php" - ], + ] + }, + "autoload-dev": { "psr-4": { "Mantle\\Tests\\": "tests" } From 4b930f517cb06a81c86e54a0ec2f51ccc52225df Mon Sep 17 00:00:00 2001 From: Sean Fisher Date: Mon, 20 Nov 2023 09:07:54 -0500 Subject: [PATCH 13/26] Adding slash --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 95e5fdd4..107e0c5c 100644 --- a/composer.json +++ b/composer.json @@ -104,7 +104,7 @@ }, "autoload-dev": { "psr-4": { - "Mantle\\Tests\\": "tests" + "Mantle\\Tests\\": "tests/" } }, "config": { From 221c29a014973152767e73f5faa3d90b7bee64ef Mon Sep 17 00:00:00 2001 From: Sean Fisher Date: Mon, 20 Nov 2023 09:17:23 -0500 Subject: [PATCH 14/26] Switching to hotfix/composer-cache --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4ab07fcf..9646ba14 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -18,7 +18,7 @@ jobs: multisite: [true, false] php: [8.0, 8.1, 8.2] wordpress: ["latest"] - uses: alleyinteractive/.github/.github/workflows/php-tests.yml@main + uses: alleyinteractive/.github/.github/workflows/php-tests.yml@hotfix/composer-cache name: "P${{ matrix.php }} - ${{ matrix.wordpress }} ${{ matrix.multisite && 'Multisite' || '' }} - ${{ matrix.dependencies }}" with: dependency-versions: ${{ matrix.dependencies }} From 693cf2a18025d783bf2d47a1e58de12c5c451876 Mon Sep 17 00:00:00 2001 From: Sean Fisher Date: Mon, 20 Nov 2023 09:19:44 -0500 Subject: [PATCH 15/26] Switch back --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9646ba14..4ab07fcf 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -18,7 +18,7 @@ jobs: multisite: [true, false] php: [8.0, 8.1, 8.2] wordpress: ["latest"] - uses: alleyinteractive/.github/.github/workflows/php-tests.yml@hotfix/composer-cache + uses: alleyinteractive/.github/.github/workflows/php-tests.yml@main name: "P${{ matrix.php }} - ${{ matrix.wordpress }} ${{ matrix.multisite && 'Multisite' || '' }} - ${{ matrix.dependencies }}" with: dependency-versions: ${{ matrix.dependencies }} From 732bbe2fb97bdeec40f9517286016d62741cee83 Mon Sep 17 00:00:00 2001 From: Sean Fisher Date: Mon, 20 Nov 2023 09:23:37 -0500 Subject: [PATCH 16/26] Adding debug for Mantle\Tests\Assets\TestCase --- tests/bootstrap.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/bootstrap.php b/tests/bootstrap.php index bcff0ff0..1e5bd58c 100755 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -14,6 +14,8 @@ // Enable debugging flag for local development on the testing framework. // define( 'MANTLE_TESTING_DEBUG', true ); +dump('debuggin Mantle\Tests\Assets\TestCase', class_exists(\Mantle\Tests\Assets\TestCase::class)); + require_once __DIR__ . '/../vendor/autoload.php'; \Mantle\Testing\manager() From 5ad9c364361d5ac46727890039b02212b39defc2 Mon Sep 17 00:00:00 2001 From: Sean Fisher Date: Mon, 20 Nov 2023 09:26:18 -0500 Subject: [PATCH 17/26] Debugging vendor/composer/autoload_psr4.php --- tests/bootstrap.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 1e5bd58c..1644a165 100755 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -14,9 +14,9 @@ // Enable debugging flag for local development on the testing framework. // define( 'MANTLE_TESTING_DEBUG', true ); -dump('debuggin Mantle\Tests\Assets\TestCase', class_exists(\Mantle\Tests\Assets\TestCase::class)); - require_once __DIR__ . '/../vendor/autoload.php'; +dump('debuggin Mantle\Tests\Assets\TestCase', class_exists(\Mantle\Tests\Assets\TestCase::class)); +dump('vendor/composer/autoload_psr4.php', file_get_contents('vendor/composer/autoload_psr4.php')); \Mantle\Testing\manager() ->maybe_rsync_plugin() From 6faa1027f53948beeeb378f41203f5041fc7769c Mon Sep 17 00:00:00 2001 From: Sean Fisher Date: Mon, 20 Nov 2023 09:37:35 -0500 Subject: [PATCH 18/26] Debug autoload_static.php --- tests/bootstrap.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 1644a165..552c83c4 100755 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -16,7 +16,7 @@ require_once __DIR__ . '/../vendor/autoload.php'; dump('debuggin Mantle\Tests\Assets\TestCase', class_exists(\Mantle\Tests\Assets\TestCase::class)); -dump('vendor/composer/autoload_psr4.php', file_get_contents('vendor/composer/autoload_psr4.php')); +dump('vendor/composer/autoload_static.php', file_get_contents('vendor/composer/autoload_static.php')); \Mantle\Testing\manager() ->maybe_rsync_plugin() From 6f191dc1ea3861c70460bbea10fb5075b3bad4a7 Mon Sep 17 00:00:00 2001 From: Sean Fisher Date: Mon, 20 Nov 2023 09:56:22 -0500 Subject: [PATCH 19/26] Move to tests/Assets --- tests/{assets => Assets}/AssetLoaderTest.php | 0 tests/{assets => Assets}/AssetManagerTest.php | 0 tests/{assets => Assets}/TestCase.php | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename tests/{assets => Assets}/AssetLoaderTest.php (100%) rename tests/{assets => Assets}/AssetManagerTest.php (100%) rename tests/{assets => Assets}/TestCase.php (100%) diff --git a/tests/assets/AssetLoaderTest.php b/tests/Assets/AssetLoaderTest.php similarity index 100% rename from tests/assets/AssetLoaderTest.php rename to tests/Assets/AssetLoaderTest.php diff --git a/tests/assets/AssetManagerTest.php b/tests/Assets/AssetManagerTest.php similarity index 100% rename from tests/assets/AssetManagerTest.php rename to tests/Assets/AssetManagerTest.php diff --git a/tests/assets/TestCase.php b/tests/Assets/TestCase.php similarity index 100% rename from tests/assets/TestCase.php rename to tests/Assets/TestCase.php From 4a8bc7548637e3ed497e93678ab5bdbeaa9e6558 Mon Sep 17 00:00:00 2001 From: Sean Fisher Date: Mon, 20 Nov 2023 09:58:31 -0500 Subject: [PATCH 20/26] Remove debug code --- tests/bootstrap.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 552c83c4..2686ddc4 100755 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -14,10 +14,6 @@ // Enable debugging flag for local development on the testing framework. // define( 'MANTLE_TESTING_DEBUG', true ); -require_once __DIR__ . '/../vendor/autoload.php'; -dump('debuggin Mantle\Tests\Assets\TestCase', class_exists(\Mantle\Tests\Assets\TestCase::class)); -dump('vendor/composer/autoload_static.php', file_get_contents('vendor/composer/autoload_static.php')); - \Mantle\Testing\manager() ->maybe_rsync_plugin() ->with_vip_mu_plugins() From e98b853da1287cbd5d0f6adecb73bc0fc29d9486 Mon Sep 17 00:00:00 2001 From: Sean Fisher Date: Mon, 20 Nov 2023 10:13:01 -0500 Subject: [PATCH 21/26] Move folders to PSR-4 --- bin/convert-psr4-dir.php | 49 +++++++++++++++++++ ...convert-psr4.php => convert-psr4-file.php} | 0 tests/{cache => Cache}/CacheManagerTest.php | 0 tests/{config => Config}/RepositoryTest.php | 0 tests/{console => Console}/CommandTest.php | 0 .../GeneratorCommandTest.php | 0 .../HookUsageCommandTest.php.bak | 0 tests/{console => Console}/ParserTest.php | 0 .../generators/PrinterTest.php | 0 .../hook-usage/base-example.php | 0 .../hook-usage/sub/sub-example.php | 0 tests/{console => Console}/test.stub | 0 .../ContainerCallTest.php | 0 .../ContainerTest.php | 0 .../Factory}/FactoryTest.php | 0 .../Factory}/UnitTestingFactoryTest.php | 0 .../Model}/AttachmentTest.php | 0 .../Model}/CommentObjectTest.php | 0 .../Model}/ModelScopeTest.php | 0 .../model => Database/Model}/ModelTest.php | 0 .../Model}/PermalinkGeneratorTest.php | 0 .../Model}/PostModelEventsTest.php | 0 .../Model}/PostObjectTest.php | 0 .../Model}/RestFieldTest.php | 0 .../Model}/SiteObjectTest.php | 0 .../Model}/TermModelEventsTest.php | 0 .../Model}/TermObjectTest.php | 0 .../Model}/UserObjectTest.php | 0 .../Model}/registration/RegisterMetaTest.php | 0 .../registration/RegisterPostTypeTest.php | 0 .../registration/RegisterTaxonomyTest.php | 0 .../relations/BelongsToOneOrManyTest.php | 0 .../Model}/relations/HasOneOrManyTest.php | 0 .../Query}/EagerLoadRelationshipsTest.php | 0 .../Query}/PaginatorTest.php | 0 .../Query}/PostQueryBuilderTest.php | 0 .../Query}/PostQueryRelationshipsTest.php | 0 .../Query}/TermQueryBuilderTest.php | 0 .../EventDispatcherTest.php | 0 .../WordPressActionDispatcherTest.php | 0 .../FilesystemAdapterTest.php | 0 .../FilesystemManagerTest.php | 0 .../FilesystemTest.php | 0 .../AliasLoaderTest.php | 0 .../ApplicationTest.php | 0 .../Blocks}/BlockProviderTest.php | 0 .../fixtures/blocks/class-mock-block.php | 0 .../fixtures/dummy/class-example-block.php | 0 .../BootloaderTest.php | 0 .../Events}/DiscoverEventsTest.php | 0 .../fixtures/events/class-event-one.php | 0 .../fixtures/events/class-event-two.php | 0 .../listeners/class-example-listener.php | 0 .../NullableCommentObjectsTestCaseTest.php | 0 .../NullablePostObjectsTestCaseTest.php | 0 .../NullableSiteObjectsTestCaseTest.php | 0 .../NullableTermObjectsTestCaseTest.php | 0 .../NullableUserObjectsTestCaseTest.php | 0 .../IsolatedFrameworkTest.php | 0 .../{framework => Framework}/PipelineTest.php | 0 .../{helpers => Helpers}/HelpersArrayTest.php | 0 .../HelpersGeneralTest.php | 0 tests/{helpers => Helpers}/HelpersTest.php | 0 tests/{http => Http}/ControllerTest.php | 0 tests/{http => Http}/RedirectorTest.php | 0 tests/{http => Http}/ResponseFactoryTest.php | 0 tests/{http => Http}/RouterTest.php | 0 .../Routing}/PostModelRoutingTest.php | 0 .../Routing}/RestApiRoutingTest.php | 0 .../Routing}/TermModelRoutingTest.php | 0 tests/{http => Http}/UploadedFileTest.php | 0 tests/{http => Http}/UrlGeneratorTest.php | 0 .../HttpClientTest.php | 0 .../{includes => Includes}/fixtures/test.txt | 0 tests/{log => Log}/LogManagerTest.php | 0 tests/{queue => Queue}/DispatcherTest.php | 0 tests/{queue => Queue}/QueueManagerTest.php | 0 tests/{queue => Queue}/WorkerTest.php | 0 .../providers/WordPressCronQueueTest.php | 0 .../{scheduling => Scheduling}/EventTest.php | 0 .../FrequencyTest.php | 0 tests/{support => Support}/ArrTest.php | 0 tests/{support => Support}/CollectionTest.php | 0 .../{support => Support}/EnvironmentTest.php | 0 .../{support => Support}/ForwardCallsTest.php | 0 tests/{support => Support}/PluralizerTest.php | 0 .../Providers}/ModelRegisterProviderTest.php | 0 .../ServiceProviderTest.php | 0 tests/{support => Support}/StrTest.php | 0 tests/{support => Support}/StringableTest.php | 0 .../Concerns}/BlockAssertionsTest.php | 0 .../Concerns}/DeprecationsTest.php | 0 .../Concerns}/ElementAssertionsTest.php | 0 .../Concerns}/IncorrectUsageTest.php | 0 .../Concerns}/InteractsWithConsoleTest.php | 0 .../InteractsWithExternalRequestsTest.php | 0 .../Concerns}/InteractsWithHooksTest.php | 0 .../Concerns}/MakesHttpRequestsTest.php | 0 .../Concerns}/WordPressAuthenticationTest.php | 0 ...tpRequestsTest__test_match_snapshot__1.yml | 0 ...estsTest__test_match_snapshot_http__1.html | 0 ...__test_match_snapshot_http_partial__1.html | 0 ...estsTest__test_match_snapshot_rest__1.json | 0 ...estsTest__test_match_snapshot_rest__2.json | 0 ...estsTest__test_match_snapshot_rest__3.json | 0 ...equestsTest__test_multiple_requests__1.yml | 0 .../{testing => Testing}/CoreTestShimTest.php | 0 .../PermalinkStructureTest.php | 0 tests/{testing => Testing}/WithFakerTest.php | 0 .../Concerns}/ExampleOverload.php | 0 .../TestkitInstallWordPressTest.php | 0 .../TestkitTestCaseTest.php | 0 tests/{testkit => Testkit}/WithFakerTest.php | 0 .../fixtures/global-functions.php | 0 tests/{view => View}/BladeViewsTest.php | 0 tests/{view => View}/FileEngineTest.php | 0 tests/{view => View}/PhpViewsTest.php | 0 tests/{view => View}/ViewFinderTest.php | 0 ..._Http_Requests__test_match_snapshot__1.yml | 3 -- ...Requests__test_match_snapshot_http__1.html | 1 - ...__test_match_snapshot_http_partial__1.html | 6 --- ...Requests__test_match_snapshot_rest__1.json | 3 -- ...Requests__test_match_snapshot_rest__2.json | 3 -- ...Requests__test_match_snapshot_rest__3.json | 26 ---------- ...tp_Requests__test_multiple_requests__1.yml | 3 -- 125 files changed, 49 insertions(+), 45 deletions(-) create mode 100644 bin/convert-psr4-dir.php rename bin/{convert-psr4.php => convert-psr4-file.php} (100%) rename tests/{cache => Cache}/CacheManagerTest.php (100%) rename tests/{config => Config}/RepositoryTest.php (100%) rename tests/{console => Console}/CommandTest.php (100%) rename tests/{console => Console}/GeneratorCommandTest.php (100%) rename tests/{console => Console}/HookUsageCommandTest.php.bak (100%) rename tests/{console => Console}/ParserTest.php (100%) rename tests/{console => Console}/generators/PrinterTest.php (100%) rename tests/{console => Console}/hook-usage/base-example.php (100%) rename tests/{console => Console}/hook-usage/sub/sub-example.php (100%) rename tests/{console => Console}/test.stub (100%) rename tests/{container => Container}/ContainerCallTest.php (100%) rename tests/{container => Container}/ContainerTest.php (100%) rename tests/{database/factory => Database/Factory}/FactoryTest.php (100%) rename tests/{database/factory => Database/Factory}/UnitTestingFactoryTest.php (100%) rename tests/{database/model => Database/Model}/AttachmentTest.php (100%) rename tests/{database/model => Database/Model}/CommentObjectTest.php (100%) rename tests/{database/model => Database/Model}/ModelScopeTest.php (100%) rename tests/{database/model => Database/Model}/ModelTest.php (100%) rename tests/{database/model => Database/Model}/PermalinkGeneratorTest.php (100%) rename tests/{database/model => Database/Model}/PostModelEventsTest.php (100%) rename tests/{database/model => Database/Model}/PostObjectTest.php (100%) rename tests/{database/model => Database/Model}/RestFieldTest.php (100%) rename tests/{database/model => Database/Model}/SiteObjectTest.php (100%) rename tests/{database/model => Database/Model}/TermModelEventsTest.php (100%) rename tests/{database/model => Database/Model}/TermObjectTest.php (100%) rename tests/{database/model => Database/Model}/UserObjectTest.php (100%) rename tests/{database/model => Database/Model}/registration/RegisterMetaTest.php (100%) rename tests/{database/model => Database/Model}/registration/RegisterPostTypeTest.php (100%) rename tests/{database/model => Database/Model}/registration/RegisterTaxonomyTest.php (100%) rename tests/{database/model => Database/Model}/relations/BelongsToOneOrManyTest.php (100%) rename tests/{database/model => Database/Model}/relations/HasOneOrManyTest.php (100%) rename tests/{database/query => Database/Query}/EagerLoadRelationshipsTest.php (100%) rename tests/{database/query => Database/Query}/PaginatorTest.php (100%) rename tests/{database/query => Database/Query}/PostQueryBuilderTest.php (100%) rename tests/{database/query => Database/Query}/PostQueryRelationshipsTest.php (100%) rename tests/{database/query => Database/Query}/TermQueryBuilderTest.php (100%) rename tests/{events => Events}/EventDispatcherTest.php (100%) rename tests/{events => Events}/WordPressActionDispatcherTest.php (100%) rename tests/{filesystem => Filesystem}/FilesystemAdapterTest.php (100%) rename tests/{filesystem => Filesystem}/FilesystemManagerTest.php (100%) rename tests/{filesystem => Filesystem}/FilesystemTest.php (100%) rename tests/{framework => Framework}/AliasLoaderTest.php (100%) rename tests/{framework => Framework}/ApplicationTest.php (100%) rename tests/{framework/blocks => Framework/Blocks}/BlockProviderTest.php (100%) rename tests/{framework/blocks => Framework/Blocks}/fixtures/blocks/class-mock-block.php (100%) rename tests/{framework/blocks => Framework/Blocks}/fixtures/dummy/class-example-block.php (100%) rename tests/{framework => Framework}/BootloaderTest.php (100%) rename tests/{framework/events => Framework/Events}/DiscoverEventsTest.php (100%) rename tests/{framework/events => Framework/Events}/fixtures/events/class-event-one.php (100%) rename tests/{framework/events => Framework/Events}/fixtures/events/class-event-two.php (100%) rename tests/{framework/events => Framework/Events}/fixtures/listeners/class-example-listener.php (100%) rename tests/{framework/helpers => Framework/Helpers}/NullableCommentObjectsTestCaseTest.php (100%) rename tests/{framework/helpers => Framework/Helpers}/NullablePostObjectsTestCaseTest.php (100%) rename tests/{framework/helpers => Framework/Helpers}/NullableSiteObjectsTestCaseTest.php (100%) rename tests/{framework/helpers => Framework/Helpers}/NullableTermObjectsTestCaseTest.php (100%) rename tests/{framework/helpers => Framework/Helpers}/NullableUserObjectsTestCaseTest.php (100%) rename tests/{framework => Framework}/IsolatedFrameworkTest.php (100%) rename tests/{framework => Framework}/PipelineTest.php (100%) rename tests/{helpers => Helpers}/HelpersArrayTest.php (100%) rename tests/{helpers => Helpers}/HelpersGeneralTest.php (100%) rename tests/{helpers => Helpers}/HelpersTest.php (100%) rename tests/{http => Http}/ControllerTest.php (100%) rename tests/{http => Http}/RedirectorTest.php (100%) rename tests/{http => Http}/ResponseFactoryTest.php (100%) rename tests/{http => Http}/RouterTest.php (100%) rename tests/{http/routing => Http/Routing}/PostModelRoutingTest.php (100%) rename tests/{http/routing => Http/Routing}/RestApiRoutingTest.php (100%) rename tests/{http/routing => Http/Routing}/TermModelRoutingTest.php (100%) rename tests/{http => Http}/UploadedFileTest.php (100%) rename tests/{http => Http}/UrlGeneratorTest.php (100%) rename tests/{http-client => HttpClient}/HttpClientTest.php (100%) rename tests/{includes => Includes}/fixtures/test.txt (100%) rename tests/{log => Log}/LogManagerTest.php (100%) rename tests/{queue => Queue}/DispatcherTest.php (100%) rename tests/{queue => Queue}/QueueManagerTest.php (100%) rename tests/{queue => Queue}/WorkerTest.php (100%) rename tests/{queue => Queue}/providers/WordPressCronQueueTest.php (100%) rename tests/{scheduling => Scheduling}/EventTest.php (100%) rename tests/{scheduling => Scheduling}/FrequencyTest.php (100%) rename tests/{support => Support}/ArrTest.php (100%) rename tests/{support => Support}/CollectionTest.php (100%) rename tests/{support => Support}/EnvironmentTest.php (100%) rename tests/{support => Support}/ForwardCallsTest.php (100%) rename tests/{support => Support}/PluralizerTest.php (100%) rename tests/{support/providers => Support/Providers}/ModelRegisterProviderTest.php (100%) rename tests/{support => Support}/ServiceProviderTest.php (100%) rename tests/{support => Support}/StrTest.php (100%) rename tests/{support => Support}/StringableTest.php (100%) rename tests/{testing/concerns => Testing/Concerns}/BlockAssertionsTest.php (100%) rename tests/{testing/concerns => Testing/Concerns}/DeprecationsTest.php (100%) rename tests/{testing/concerns => Testing/Concerns}/ElementAssertionsTest.php (100%) rename tests/{testing/concerns => Testing/Concerns}/IncorrectUsageTest.php (100%) rename tests/{testing/concerns => Testing/Concerns}/InteractsWithConsoleTest.php (100%) rename tests/{testing/concerns => Testing/Concerns}/InteractsWithExternalRequestsTest.php (100%) rename tests/{testing/concerns => Testing/Concerns}/InteractsWithHooksTest.php (100%) rename tests/{testing/concerns => Testing/Concerns}/MakesHttpRequestsTest.php (100%) rename tests/{testing/concerns => Testing/Concerns}/WordPressAuthenticationTest.php (100%) rename tests/{testing/concerns => Testing/Concerns}/__snapshots__/MakesHttpRequestsTest__test_match_snapshot__1.yml (100%) rename tests/{testing/concerns => Testing/Concerns}/__snapshots__/MakesHttpRequestsTest__test_match_snapshot_http__1.html (100%) rename tests/{testing/concerns => Testing/Concerns}/__snapshots__/MakesHttpRequestsTest__test_match_snapshot_http_partial__1.html (100%) rename tests/{testing/concerns => Testing/Concerns}/__snapshots__/MakesHttpRequestsTest__test_match_snapshot_rest__1.json (100%) rename tests/{testing/concerns => Testing/Concerns}/__snapshots__/MakesHttpRequestsTest__test_match_snapshot_rest__2.json (100%) rename tests/{testing/concerns => Testing/Concerns}/__snapshots__/MakesHttpRequestsTest__test_match_snapshot_rest__3.json (100%) rename tests/{testing/concerns => Testing/Concerns}/__snapshots__/MakesHttpRequestsTest__test_multiple_requests__1.yml (100%) rename tests/{testing => Testing}/CoreTestShimTest.php (100%) rename tests/{testing => Testing}/PermalinkStructureTest.php (100%) rename tests/{testing => Testing}/WithFakerTest.php (100%) rename tests/{testkit/concerns => Testkit/Concerns}/ExampleOverload.php (100%) rename tests/{testkit => Testkit}/TestkitInstallWordPressTest.php (100%) rename tests/{testkit => Testkit}/TestkitTestCaseTest.php (100%) rename tests/{testkit => Testkit}/WithFakerTest.php (100%) rename tests/{testkit => Testkit}/fixtures/global-functions.php (100%) rename tests/{view => View}/BladeViewsTest.php (100%) rename tests/{view => View}/FileEngineTest.php (100%) rename tests/{view => View}/PhpViewsTest.php (100%) rename tests/{view => View}/ViewFinderTest.php (100%) delete mode 100644 tests/testing/concerns/__snapshots__/Test_Makes_Http_Requests__test_match_snapshot__1.yml delete mode 100644 tests/testing/concerns/__snapshots__/Test_Makes_Http_Requests__test_match_snapshot_http__1.html delete mode 100644 tests/testing/concerns/__snapshots__/Test_Makes_Http_Requests__test_match_snapshot_http_partial__1.html delete mode 100644 tests/testing/concerns/__snapshots__/Test_Makes_Http_Requests__test_match_snapshot_rest__1.json delete mode 100644 tests/testing/concerns/__snapshots__/Test_Makes_Http_Requests__test_match_snapshot_rest__2.json delete mode 100644 tests/testing/concerns/__snapshots__/Test_Makes_Http_Requests__test_match_snapshot_rest__3.json delete mode 100644 tests/testing/concerns/__snapshots__/Test_Makes_Http_Requests__test_multiple_requests__1.yml diff --git a/bin/convert-psr4-dir.php b/bin/convert-psr4-dir.php new file mode 100644 index 00000000..0dc6e535 --- /dev/null +++ b/bin/convert-psr4-dir.php @@ -0,0 +1,49 @@ +in( realpath( __DIR__ . '/../tests' ) ) + ->directories() + ->notPath( '#fixtures|__snapshots__|template-parts#' ); + +$base = Str::trailing_slash( realpath( __DIR__ . '/../tests/' ) ); + +foreach ( $finder as $dir ) { + $old_dir = $dir->getRealPath(); + + if ( ! is_dir( $old_dir ) ) { + continue; + } + + $parts = str( $old_dir )->after( $base )->explode( '/' ); + + $parts = $parts->map( + fn ( string $part ) => str( $part )->studly()->value(), + ); + + $new_dir = $base . $parts->implode( '/' ); + + dump( "Moving {$old_dir} to {$new_dir}" ); + + shell_exec( "git mv {$old_dir} {$old_dir}-tmp" ); + shell_exec( "git mv {$old_dir}-tmp {$new_dir}" ); +} + +echo "\nDONE!\n"; + +exit( 0 ); diff --git a/bin/convert-psr4.php b/bin/convert-psr4-file.php similarity index 100% rename from bin/convert-psr4.php rename to bin/convert-psr4-file.php diff --git a/tests/cache/CacheManagerTest.php b/tests/Cache/CacheManagerTest.php similarity index 100% rename from tests/cache/CacheManagerTest.php rename to tests/Cache/CacheManagerTest.php diff --git a/tests/config/RepositoryTest.php b/tests/Config/RepositoryTest.php similarity index 100% rename from tests/config/RepositoryTest.php rename to tests/Config/RepositoryTest.php diff --git a/tests/console/CommandTest.php b/tests/Console/CommandTest.php similarity index 100% rename from tests/console/CommandTest.php rename to tests/Console/CommandTest.php diff --git a/tests/console/GeneratorCommandTest.php b/tests/Console/GeneratorCommandTest.php similarity index 100% rename from tests/console/GeneratorCommandTest.php rename to tests/Console/GeneratorCommandTest.php diff --git a/tests/console/HookUsageCommandTest.php.bak b/tests/Console/HookUsageCommandTest.php.bak similarity index 100% rename from tests/console/HookUsageCommandTest.php.bak rename to tests/Console/HookUsageCommandTest.php.bak diff --git a/tests/console/ParserTest.php b/tests/Console/ParserTest.php similarity index 100% rename from tests/console/ParserTest.php rename to tests/Console/ParserTest.php diff --git a/tests/console/generators/PrinterTest.php b/tests/Console/generators/PrinterTest.php similarity index 100% rename from tests/console/generators/PrinterTest.php rename to tests/Console/generators/PrinterTest.php diff --git a/tests/console/hook-usage/base-example.php b/tests/Console/hook-usage/base-example.php similarity index 100% rename from tests/console/hook-usage/base-example.php rename to tests/Console/hook-usage/base-example.php diff --git a/tests/console/hook-usage/sub/sub-example.php b/tests/Console/hook-usage/sub/sub-example.php similarity index 100% rename from tests/console/hook-usage/sub/sub-example.php rename to tests/Console/hook-usage/sub/sub-example.php diff --git a/tests/console/test.stub b/tests/Console/test.stub similarity index 100% rename from tests/console/test.stub rename to tests/Console/test.stub diff --git a/tests/container/ContainerCallTest.php b/tests/Container/ContainerCallTest.php similarity index 100% rename from tests/container/ContainerCallTest.php rename to tests/Container/ContainerCallTest.php diff --git a/tests/container/ContainerTest.php b/tests/Container/ContainerTest.php similarity index 100% rename from tests/container/ContainerTest.php rename to tests/Container/ContainerTest.php diff --git a/tests/database/factory/FactoryTest.php b/tests/Database/Factory/FactoryTest.php similarity index 100% rename from tests/database/factory/FactoryTest.php rename to tests/Database/Factory/FactoryTest.php diff --git a/tests/database/factory/UnitTestingFactoryTest.php b/tests/Database/Factory/UnitTestingFactoryTest.php similarity index 100% rename from tests/database/factory/UnitTestingFactoryTest.php rename to tests/Database/Factory/UnitTestingFactoryTest.php diff --git a/tests/database/model/AttachmentTest.php b/tests/Database/Model/AttachmentTest.php similarity index 100% rename from tests/database/model/AttachmentTest.php rename to tests/Database/Model/AttachmentTest.php diff --git a/tests/database/model/CommentObjectTest.php b/tests/Database/Model/CommentObjectTest.php similarity index 100% rename from tests/database/model/CommentObjectTest.php rename to tests/Database/Model/CommentObjectTest.php diff --git a/tests/database/model/ModelScopeTest.php b/tests/Database/Model/ModelScopeTest.php similarity index 100% rename from tests/database/model/ModelScopeTest.php rename to tests/Database/Model/ModelScopeTest.php diff --git a/tests/database/model/ModelTest.php b/tests/Database/Model/ModelTest.php similarity index 100% rename from tests/database/model/ModelTest.php rename to tests/Database/Model/ModelTest.php diff --git a/tests/database/model/PermalinkGeneratorTest.php b/tests/Database/Model/PermalinkGeneratorTest.php similarity index 100% rename from tests/database/model/PermalinkGeneratorTest.php rename to tests/Database/Model/PermalinkGeneratorTest.php diff --git a/tests/database/model/PostModelEventsTest.php b/tests/Database/Model/PostModelEventsTest.php similarity index 100% rename from tests/database/model/PostModelEventsTest.php rename to tests/Database/Model/PostModelEventsTest.php diff --git a/tests/database/model/PostObjectTest.php b/tests/Database/Model/PostObjectTest.php similarity index 100% rename from tests/database/model/PostObjectTest.php rename to tests/Database/Model/PostObjectTest.php diff --git a/tests/database/model/RestFieldTest.php b/tests/Database/Model/RestFieldTest.php similarity index 100% rename from tests/database/model/RestFieldTest.php rename to tests/Database/Model/RestFieldTest.php diff --git a/tests/database/model/SiteObjectTest.php b/tests/Database/Model/SiteObjectTest.php similarity index 100% rename from tests/database/model/SiteObjectTest.php rename to tests/Database/Model/SiteObjectTest.php diff --git a/tests/database/model/TermModelEventsTest.php b/tests/Database/Model/TermModelEventsTest.php similarity index 100% rename from tests/database/model/TermModelEventsTest.php rename to tests/Database/Model/TermModelEventsTest.php diff --git a/tests/database/model/TermObjectTest.php b/tests/Database/Model/TermObjectTest.php similarity index 100% rename from tests/database/model/TermObjectTest.php rename to tests/Database/Model/TermObjectTest.php diff --git a/tests/database/model/UserObjectTest.php b/tests/Database/Model/UserObjectTest.php similarity index 100% rename from tests/database/model/UserObjectTest.php rename to tests/Database/Model/UserObjectTest.php diff --git a/tests/database/model/registration/RegisterMetaTest.php b/tests/Database/Model/registration/RegisterMetaTest.php similarity index 100% rename from tests/database/model/registration/RegisterMetaTest.php rename to tests/Database/Model/registration/RegisterMetaTest.php diff --git a/tests/database/model/registration/RegisterPostTypeTest.php b/tests/Database/Model/registration/RegisterPostTypeTest.php similarity index 100% rename from tests/database/model/registration/RegisterPostTypeTest.php rename to tests/Database/Model/registration/RegisterPostTypeTest.php diff --git a/tests/database/model/registration/RegisterTaxonomyTest.php b/tests/Database/Model/registration/RegisterTaxonomyTest.php similarity index 100% rename from tests/database/model/registration/RegisterTaxonomyTest.php rename to tests/Database/Model/registration/RegisterTaxonomyTest.php diff --git a/tests/database/model/relations/BelongsToOneOrManyTest.php b/tests/Database/Model/relations/BelongsToOneOrManyTest.php similarity index 100% rename from tests/database/model/relations/BelongsToOneOrManyTest.php rename to tests/Database/Model/relations/BelongsToOneOrManyTest.php diff --git a/tests/database/model/relations/HasOneOrManyTest.php b/tests/Database/Model/relations/HasOneOrManyTest.php similarity index 100% rename from tests/database/model/relations/HasOneOrManyTest.php rename to tests/Database/Model/relations/HasOneOrManyTest.php diff --git a/tests/database/query/EagerLoadRelationshipsTest.php b/tests/Database/Query/EagerLoadRelationshipsTest.php similarity index 100% rename from tests/database/query/EagerLoadRelationshipsTest.php rename to tests/Database/Query/EagerLoadRelationshipsTest.php diff --git a/tests/database/query/PaginatorTest.php b/tests/Database/Query/PaginatorTest.php similarity index 100% rename from tests/database/query/PaginatorTest.php rename to tests/Database/Query/PaginatorTest.php diff --git a/tests/database/query/PostQueryBuilderTest.php b/tests/Database/Query/PostQueryBuilderTest.php similarity index 100% rename from tests/database/query/PostQueryBuilderTest.php rename to tests/Database/Query/PostQueryBuilderTest.php diff --git a/tests/database/query/PostQueryRelationshipsTest.php b/tests/Database/Query/PostQueryRelationshipsTest.php similarity index 100% rename from tests/database/query/PostQueryRelationshipsTest.php rename to tests/Database/Query/PostQueryRelationshipsTest.php diff --git a/tests/database/query/TermQueryBuilderTest.php b/tests/Database/Query/TermQueryBuilderTest.php similarity index 100% rename from tests/database/query/TermQueryBuilderTest.php rename to tests/Database/Query/TermQueryBuilderTest.php diff --git a/tests/events/EventDispatcherTest.php b/tests/Events/EventDispatcherTest.php similarity index 100% rename from tests/events/EventDispatcherTest.php rename to tests/Events/EventDispatcherTest.php diff --git a/tests/events/WordPressActionDispatcherTest.php b/tests/Events/WordPressActionDispatcherTest.php similarity index 100% rename from tests/events/WordPressActionDispatcherTest.php rename to tests/Events/WordPressActionDispatcherTest.php diff --git a/tests/filesystem/FilesystemAdapterTest.php b/tests/Filesystem/FilesystemAdapterTest.php similarity index 100% rename from tests/filesystem/FilesystemAdapterTest.php rename to tests/Filesystem/FilesystemAdapterTest.php diff --git a/tests/filesystem/FilesystemManagerTest.php b/tests/Filesystem/FilesystemManagerTest.php similarity index 100% rename from tests/filesystem/FilesystemManagerTest.php rename to tests/Filesystem/FilesystemManagerTest.php diff --git a/tests/filesystem/FilesystemTest.php b/tests/Filesystem/FilesystemTest.php similarity index 100% rename from tests/filesystem/FilesystemTest.php rename to tests/Filesystem/FilesystemTest.php diff --git a/tests/framework/AliasLoaderTest.php b/tests/Framework/AliasLoaderTest.php similarity index 100% rename from tests/framework/AliasLoaderTest.php rename to tests/Framework/AliasLoaderTest.php diff --git a/tests/framework/ApplicationTest.php b/tests/Framework/ApplicationTest.php similarity index 100% rename from tests/framework/ApplicationTest.php rename to tests/Framework/ApplicationTest.php diff --git a/tests/framework/blocks/BlockProviderTest.php b/tests/Framework/Blocks/BlockProviderTest.php similarity index 100% rename from tests/framework/blocks/BlockProviderTest.php rename to tests/Framework/Blocks/BlockProviderTest.php diff --git a/tests/framework/blocks/fixtures/blocks/class-mock-block.php b/tests/Framework/Blocks/fixtures/blocks/class-mock-block.php similarity index 100% rename from tests/framework/blocks/fixtures/blocks/class-mock-block.php rename to tests/Framework/Blocks/fixtures/blocks/class-mock-block.php diff --git a/tests/framework/blocks/fixtures/dummy/class-example-block.php b/tests/Framework/Blocks/fixtures/dummy/class-example-block.php similarity index 100% rename from tests/framework/blocks/fixtures/dummy/class-example-block.php rename to tests/Framework/Blocks/fixtures/dummy/class-example-block.php diff --git a/tests/framework/BootloaderTest.php b/tests/Framework/BootloaderTest.php similarity index 100% rename from tests/framework/BootloaderTest.php rename to tests/Framework/BootloaderTest.php diff --git a/tests/framework/events/DiscoverEventsTest.php b/tests/Framework/Events/DiscoverEventsTest.php similarity index 100% rename from tests/framework/events/DiscoverEventsTest.php rename to tests/Framework/Events/DiscoverEventsTest.php diff --git a/tests/framework/events/fixtures/events/class-event-one.php b/tests/Framework/Events/fixtures/events/class-event-one.php similarity index 100% rename from tests/framework/events/fixtures/events/class-event-one.php rename to tests/Framework/Events/fixtures/events/class-event-one.php diff --git a/tests/framework/events/fixtures/events/class-event-two.php b/tests/Framework/Events/fixtures/events/class-event-two.php similarity index 100% rename from tests/framework/events/fixtures/events/class-event-two.php rename to tests/Framework/Events/fixtures/events/class-event-two.php diff --git a/tests/framework/events/fixtures/listeners/class-example-listener.php b/tests/Framework/Events/fixtures/listeners/class-example-listener.php similarity index 100% rename from tests/framework/events/fixtures/listeners/class-example-listener.php rename to tests/Framework/Events/fixtures/listeners/class-example-listener.php diff --git a/tests/framework/helpers/NullableCommentObjectsTestCaseTest.php b/tests/Framework/Helpers/NullableCommentObjectsTestCaseTest.php similarity index 100% rename from tests/framework/helpers/NullableCommentObjectsTestCaseTest.php rename to tests/Framework/Helpers/NullableCommentObjectsTestCaseTest.php diff --git a/tests/framework/helpers/NullablePostObjectsTestCaseTest.php b/tests/Framework/Helpers/NullablePostObjectsTestCaseTest.php similarity index 100% rename from tests/framework/helpers/NullablePostObjectsTestCaseTest.php rename to tests/Framework/Helpers/NullablePostObjectsTestCaseTest.php diff --git a/tests/framework/helpers/NullableSiteObjectsTestCaseTest.php b/tests/Framework/Helpers/NullableSiteObjectsTestCaseTest.php similarity index 100% rename from tests/framework/helpers/NullableSiteObjectsTestCaseTest.php rename to tests/Framework/Helpers/NullableSiteObjectsTestCaseTest.php diff --git a/tests/framework/helpers/NullableTermObjectsTestCaseTest.php b/tests/Framework/Helpers/NullableTermObjectsTestCaseTest.php similarity index 100% rename from tests/framework/helpers/NullableTermObjectsTestCaseTest.php rename to tests/Framework/Helpers/NullableTermObjectsTestCaseTest.php diff --git a/tests/framework/helpers/NullableUserObjectsTestCaseTest.php b/tests/Framework/Helpers/NullableUserObjectsTestCaseTest.php similarity index 100% rename from tests/framework/helpers/NullableUserObjectsTestCaseTest.php rename to tests/Framework/Helpers/NullableUserObjectsTestCaseTest.php diff --git a/tests/framework/IsolatedFrameworkTest.php b/tests/Framework/IsolatedFrameworkTest.php similarity index 100% rename from tests/framework/IsolatedFrameworkTest.php rename to tests/Framework/IsolatedFrameworkTest.php diff --git a/tests/framework/PipelineTest.php b/tests/Framework/PipelineTest.php similarity index 100% rename from tests/framework/PipelineTest.php rename to tests/Framework/PipelineTest.php diff --git a/tests/helpers/HelpersArrayTest.php b/tests/Helpers/HelpersArrayTest.php similarity index 100% rename from tests/helpers/HelpersArrayTest.php rename to tests/Helpers/HelpersArrayTest.php diff --git a/tests/helpers/HelpersGeneralTest.php b/tests/Helpers/HelpersGeneralTest.php similarity index 100% rename from tests/helpers/HelpersGeneralTest.php rename to tests/Helpers/HelpersGeneralTest.php diff --git a/tests/helpers/HelpersTest.php b/tests/Helpers/HelpersTest.php similarity index 100% rename from tests/helpers/HelpersTest.php rename to tests/Helpers/HelpersTest.php diff --git a/tests/http/ControllerTest.php b/tests/Http/ControllerTest.php similarity index 100% rename from tests/http/ControllerTest.php rename to tests/Http/ControllerTest.php diff --git a/tests/http/RedirectorTest.php b/tests/Http/RedirectorTest.php similarity index 100% rename from tests/http/RedirectorTest.php rename to tests/Http/RedirectorTest.php diff --git a/tests/http/ResponseFactoryTest.php b/tests/Http/ResponseFactoryTest.php similarity index 100% rename from tests/http/ResponseFactoryTest.php rename to tests/Http/ResponseFactoryTest.php diff --git a/tests/http/RouterTest.php b/tests/Http/RouterTest.php similarity index 100% rename from tests/http/RouterTest.php rename to tests/Http/RouterTest.php diff --git a/tests/http/routing/PostModelRoutingTest.php b/tests/Http/Routing/PostModelRoutingTest.php similarity index 100% rename from tests/http/routing/PostModelRoutingTest.php rename to tests/Http/Routing/PostModelRoutingTest.php diff --git a/tests/http/routing/RestApiRoutingTest.php b/tests/Http/Routing/RestApiRoutingTest.php similarity index 100% rename from tests/http/routing/RestApiRoutingTest.php rename to tests/Http/Routing/RestApiRoutingTest.php diff --git a/tests/http/routing/TermModelRoutingTest.php b/tests/Http/Routing/TermModelRoutingTest.php similarity index 100% rename from tests/http/routing/TermModelRoutingTest.php rename to tests/Http/Routing/TermModelRoutingTest.php diff --git a/tests/http/UploadedFileTest.php b/tests/Http/UploadedFileTest.php similarity index 100% rename from tests/http/UploadedFileTest.php rename to tests/Http/UploadedFileTest.php diff --git a/tests/http/UrlGeneratorTest.php b/tests/Http/UrlGeneratorTest.php similarity index 100% rename from tests/http/UrlGeneratorTest.php rename to tests/Http/UrlGeneratorTest.php diff --git a/tests/http-client/HttpClientTest.php b/tests/HttpClient/HttpClientTest.php similarity index 100% rename from tests/http-client/HttpClientTest.php rename to tests/HttpClient/HttpClientTest.php diff --git a/tests/includes/fixtures/test.txt b/tests/Includes/fixtures/test.txt similarity index 100% rename from tests/includes/fixtures/test.txt rename to tests/Includes/fixtures/test.txt diff --git a/tests/log/LogManagerTest.php b/tests/Log/LogManagerTest.php similarity index 100% rename from tests/log/LogManagerTest.php rename to tests/Log/LogManagerTest.php diff --git a/tests/queue/DispatcherTest.php b/tests/Queue/DispatcherTest.php similarity index 100% rename from tests/queue/DispatcherTest.php rename to tests/Queue/DispatcherTest.php diff --git a/tests/queue/QueueManagerTest.php b/tests/Queue/QueueManagerTest.php similarity index 100% rename from tests/queue/QueueManagerTest.php rename to tests/Queue/QueueManagerTest.php diff --git a/tests/queue/WorkerTest.php b/tests/Queue/WorkerTest.php similarity index 100% rename from tests/queue/WorkerTest.php rename to tests/Queue/WorkerTest.php diff --git a/tests/queue/providers/WordPressCronQueueTest.php b/tests/Queue/providers/WordPressCronQueueTest.php similarity index 100% rename from tests/queue/providers/WordPressCronQueueTest.php rename to tests/Queue/providers/WordPressCronQueueTest.php diff --git a/tests/scheduling/EventTest.php b/tests/Scheduling/EventTest.php similarity index 100% rename from tests/scheduling/EventTest.php rename to tests/Scheduling/EventTest.php diff --git a/tests/scheduling/FrequencyTest.php b/tests/Scheduling/FrequencyTest.php similarity index 100% rename from tests/scheduling/FrequencyTest.php rename to tests/Scheduling/FrequencyTest.php diff --git a/tests/support/ArrTest.php b/tests/Support/ArrTest.php similarity index 100% rename from tests/support/ArrTest.php rename to tests/Support/ArrTest.php diff --git a/tests/support/CollectionTest.php b/tests/Support/CollectionTest.php similarity index 100% rename from tests/support/CollectionTest.php rename to tests/Support/CollectionTest.php diff --git a/tests/support/EnvironmentTest.php b/tests/Support/EnvironmentTest.php similarity index 100% rename from tests/support/EnvironmentTest.php rename to tests/Support/EnvironmentTest.php diff --git a/tests/support/ForwardCallsTest.php b/tests/Support/ForwardCallsTest.php similarity index 100% rename from tests/support/ForwardCallsTest.php rename to tests/Support/ForwardCallsTest.php diff --git a/tests/support/PluralizerTest.php b/tests/Support/PluralizerTest.php similarity index 100% rename from tests/support/PluralizerTest.php rename to tests/Support/PluralizerTest.php diff --git a/tests/support/providers/ModelRegisterProviderTest.php b/tests/Support/Providers/ModelRegisterProviderTest.php similarity index 100% rename from tests/support/providers/ModelRegisterProviderTest.php rename to tests/Support/Providers/ModelRegisterProviderTest.php diff --git a/tests/support/ServiceProviderTest.php b/tests/Support/ServiceProviderTest.php similarity index 100% rename from tests/support/ServiceProviderTest.php rename to tests/Support/ServiceProviderTest.php diff --git a/tests/support/StrTest.php b/tests/Support/StrTest.php similarity index 100% rename from tests/support/StrTest.php rename to tests/Support/StrTest.php diff --git a/tests/support/StringableTest.php b/tests/Support/StringableTest.php similarity index 100% rename from tests/support/StringableTest.php rename to tests/Support/StringableTest.php diff --git a/tests/testing/concerns/BlockAssertionsTest.php b/tests/Testing/Concerns/BlockAssertionsTest.php similarity index 100% rename from tests/testing/concerns/BlockAssertionsTest.php rename to tests/Testing/Concerns/BlockAssertionsTest.php diff --git a/tests/testing/concerns/DeprecationsTest.php b/tests/Testing/Concerns/DeprecationsTest.php similarity index 100% rename from tests/testing/concerns/DeprecationsTest.php rename to tests/Testing/Concerns/DeprecationsTest.php diff --git a/tests/testing/concerns/ElementAssertionsTest.php b/tests/Testing/Concerns/ElementAssertionsTest.php similarity index 100% rename from tests/testing/concerns/ElementAssertionsTest.php rename to tests/Testing/Concerns/ElementAssertionsTest.php diff --git a/tests/testing/concerns/IncorrectUsageTest.php b/tests/Testing/Concerns/IncorrectUsageTest.php similarity index 100% rename from tests/testing/concerns/IncorrectUsageTest.php rename to tests/Testing/Concerns/IncorrectUsageTest.php diff --git a/tests/testing/concerns/InteractsWithConsoleTest.php b/tests/Testing/Concerns/InteractsWithConsoleTest.php similarity index 100% rename from tests/testing/concerns/InteractsWithConsoleTest.php rename to tests/Testing/Concerns/InteractsWithConsoleTest.php diff --git a/tests/testing/concerns/InteractsWithExternalRequestsTest.php b/tests/Testing/Concerns/InteractsWithExternalRequestsTest.php similarity index 100% rename from tests/testing/concerns/InteractsWithExternalRequestsTest.php rename to tests/Testing/Concerns/InteractsWithExternalRequestsTest.php diff --git a/tests/testing/concerns/InteractsWithHooksTest.php b/tests/Testing/Concerns/InteractsWithHooksTest.php similarity index 100% rename from tests/testing/concerns/InteractsWithHooksTest.php rename to tests/Testing/Concerns/InteractsWithHooksTest.php diff --git a/tests/testing/concerns/MakesHttpRequestsTest.php b/tests/Testing/Concerns/MakesHttpRequestsTest.php similarity index 100% rename from tests/testing/concerns/MakesHttpRequestsTest.php rename to tests/Testing/Concerns/MakesHttpRequestsTest.php diff --git a/tests/testing/concerns/WordPressAuthenticationTest.php b/tests/Testing/Concerns/WordPressAuthenticationTest.php similarity index 100% rename from tests/testing/concerns/WordPressAuthenticationTest.php rename to tests/Testing/Concerns/WordPressAuthenticationTest.php diff --git a/tests/testing/concerns/__snapshots__/MakesHttpRequestsTest__test_match_snapshot__1.yml b/tests/Testing/Concerns/__snapshots__/MakesHttpRequestsTest__test_match_snapshot__1.yml similarity index 100% rename from tests/testing/concerns/__snapshots__/MakesHttpRequestsTest__test_match_snapshot__1.yml rename to tests/Testing/Concerns/__snapshots__/MakesHttpRequestsTest__test_match_snapshot__1.yml diff --git a/tests/testing/concerns/__snapshots__/MakesHttpRequestsTest__test_match_snapshot_http__1.html b/tests/Testing/Concerns/__snapshots__/MakesHttpRequestsTest__test_match_snapshot_http__1.html similarity index 100% rename from tests/testing/concerns/__snapshots__/MakesHttpRequestsTest__test_match_snapshot_http__1.html rename to tests/Testing/Concerns/__snapshots__/MakesHttpRequestsTest__test_match_snapshot_http__1.html diff --git a/tests/testing/concerns/__snapshots__/MakesHttpRequestsTest__test_match_snapshot_http_partial__1.html b/tests/Testing/Concerns/__snapshots__/MakesHttpRequestsTest__test_match_snapshot_http_partial__1.html similarity index 100% rename from tests/testing/concerns/__snapshots__/MakesHttpRequestsTest__test_match_snapshot_http_partial__1.html rename to tests/Testing/Concerns/__snapshots__/MakesHttpRequestsTest__test_match_snapshot_http_partial__1.html diff --git a/tests/testing/concerns/__snapshots__/MakesHttpRequestsTest__test_match_snapshot_rest__1.json b/tests/Testing/Concerns/__snapshots__/MakesHttpRequestsTest__test_match_snapshot_rest__1.json similarity index 100% rename from tests/testing/concerns/__snapshots__/MakesHttpRequestsTest__test_match_snapshot_rest__1.json rename to tests/Testing/Concerns/__snapshots__/MakesHttpRequestsTest__test_match_snapshot_rest__1.json diff --git a/tests/testing/concerns/__snapshots__/MakesHttpRequestsTest__test_match_snapshot_rest__2.json b/tests/Testing/Concerns/__snapshots__/MakesHttpRequestsTest__test_match_snapshot_rest__2.json similarity index 100% rename from tests/testing/concerns/__snapshots__/MakesHttpRequestsTest__test_match_snapshot_rest__2.json rename to tests/Testing/Concerns/__snapshots__/MakesHttpRequestsTest__test_match_snapshot_rest__2.json diff --git a/tests/testing/concerns/__snapshots__/MakesHttpRequestsTest__test_match_snapshot_rest__3.json b/tests/Testing/Concerns/__snapshots__/MakesHttpRequestsTest__test_match_snapshot_rest__3.json similarity index 100% rename from tests/testing/concerns/__snapshots__/MakesHttpRequestsTest__test_match_snapshot_rest__3.json rename to tests/Testing/Concerns/__snapshots__/MakesHttpRequestsTest__test_match_snapshot_rest__3.json diff --git a/tests/testing/concerns/__snapshots__/MakesHttpRequestsTest__test_multiple_requests__1.yml b/tests/Testing/Concerns/__snapshots__/MakesHttpRequestsTest__test_multiple_requests__1.yml similarity index 100% rename from tests/testing/concerns/__snapshots__/MakesHttpRequestsTest__test_multiple_requests__1.yml rename to tests/Testing/Concerns/__snapshots__/MakesHttpRequestsTest__test_multiple_requests__1.yml diff --git a/tests/testing/CoreTestShimTest.php b/tests/Testing/CoreTestShimTest.php similarity index 100% rename from tests/testing/CoreTestShimTest.php rename to tests/Testing/CoreTestShimTest.php diff --git a/tests/testing/PermalinkStructureTest.php b/tests/Testing/PermalinkStructureTest.php similarity index 100% rename from tests/testing/PermalinkStructureTest.php rename to tests/Testing/PermalinkStructureTest.php diff --git a/tests/testing/WithFakerTest.php b/tests/Testing/WithFakerTest.php similarity index 100% rename from tests/testing/WithFakerTest.php rename to tests/Testing/WithFakerTest.php diff --git a/tests/testkit/concerns/ExampleOverload.php b/tests/Testkit/Concerns/ExampleOverload.php similarity index 100% rename from tests/testkit/concerns/ExampleOverload.php rename to tests/Testkit/Concerns/ExampleOverload.php diff --git a/tests/testkit/TestkitInstallWordPressTest.php b/tests/Testkit/TestkitInstallWordPressTest.php similarity index 100% rename from tests/testkit/TestkitInstallWordPressTest.php rename to tests/Testkit/TestkitInstallWordPressTest.php diff --git a/tests/testkit/TestkitTestCaseTest.php b/tests/Testkit/TestkitTestCaseTest.php similarity index 100% rename from tests/testkit/TestkitTestCaseTest.php rename to tests/Testkit/TestkitTestCaseTest.php diff --git a/tests/testkit/WithFakerTest.php b/tests/Testkit/WithFakerTest.php similarity index 100% rename from tests/testkit/WithFakerTest.php rename to tests/Testkit/WithFakerTest.php diff --git a/tests/testkit/fixtures/global-functions.php b/tests/Testkit/fixtures/global-functions.php similarity index 100% rename from tests/testkit/fixtures/global-functions.php rename to tests/Testkit/fixtures/global-functions.php diff --git a/tests/view/BladeViewsTest.php b/tests/View/BladeViewsTest.php similarity index 100% rename from tests/view/BladeViewsTest.php rename to tests/View/BladeViewsTest.php diff --git a/tests/view/FileEngineTest.php b/tests/View/FileEngineTest.php similarity index 100% rename from tests/view/FileEngineTest.php rename to tests/View/FileEngineTest.php diff --git a/tests/view/PhpViewsTest.php b/tests/View/PhpViewsTest.php similarity index 100% rename from tests/view/PhpViewsTest.php rename to tests/View/PhpViewsTest.php diff --git a/tests/view/ViewFinderTest.php b/tests/View/ViewFinderTest.php similarity index 100% rename from tests/view/ViewFinderTest.php rename to tests/View/ViewFinderTest.php diff --git a/tests/testing/concerns/__snapshots__/Test_Makes_Http_Requests__test_match_snapshot__1.yml b/tests/testing/concerns/__snapshots__/Test_Makes_Http_Requests__test_match_snapshot__1.yml deleted file mode 100644 index a0cd6f38..00000000 --- a/tests/testing/concerns/__snapshots__/Test_Makes_Http_Requests__test_match_snapshot__1.yml +++ /dev/null @@ -1,3 +0,0 @@ -- 1 -- 2 -- 3 diff --git a/tests/testing/concerns/__snapshots__/Test_Makes_Http_Requests__test_match_snapshot_http__1.html b/tests/testing/concerns/__snapshots__/Test_Makes_Http_Requests__test_match_snapshot_http__1.html deleted file mode 100644 index 1b9e0726..00000000 --- a/tests/testing/concerns/__snapshots__/Test_Makes_Http_Requests__test_match_snapshot_http__1.html +++ /dev/null @@ -1 +0,0 @@ -

example

diff --git a/tests/testing/concerns/__snapshots__/Test_Makes_Http_Requests__test_match_snapshot_http_partial__1.html b/tests/testing/concerns/__snapshots__/Test_Makes_Http_Requests__test_match_snapshot_http_partial__1.html deleted file mode 100644 index 653788ff..00000000 --- a/tests/testing/concerns/__snapshots__/Test_Makes_Http_Requests__test_match_snapshot_http_partial__1.html +++ /dev/null @@ -1,6 +0,0 @@ -
-

Example

-
-

Example two

-
-
diff --git a/tests/testing/concerns/__snapshots__/Test_Makes_Http_Requests__test_match_snapshot_rest__1.json b/tests/testing/concerns/__snapshots__/Test_Makes_Http_Requests__test_match_snapshot_rest__1.json deleted file mode 100644 index 3e2ca0ff..00000000 --- a/tests/testing/concerns/__snapshots__/Test_Makes_Http_Requests__test_match_snapshot_rest__1.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "key": "value here" -} diff --git a/tests/testing/concerns/__snapshots__/Test_Makes_Http_Requests__test_match_snapshot_rest__2.json b/tests/testing/concerns/__snapshots__/Test_Makes_Http_Requests__test_match_snapshot_rest__2.json deleted file mode 100644 index ffdede42..00000000 --- a/tests/testing/concerns/__snapshots__/Test_Makes_Http_Requests__test_match_snapshot_rest__2.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "type": "post" -} diff --git a/tests/testing/concerns/__snapshots__/Test_Makes_Http_Requests__test_match_snapshot_rest__3.json b/tests/testing/concerns/__snapshots__/Test_Makes_Http_Requests__test_match_snapshot_rest__3.json deleted file mode 100644 index 347a5ba5..00000000 --- a/tests/testing/concerns/__snapshots__/Test_Makes_Http_Requests__test_match_snapshot_rest__3.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "*.type": [ - "post", - "post", - "post", - "post", - "post", - "post", - "post", - "post", - "post", - "post" - ], - "*.status": [ - "publish", - "publish", - "publish", - "publish", - "publish", - "publish", - "publish", - "publish", - "publish", - "publish" - ] -} diff --git a/tests/testing/concerns/__snapshots__/Test_Makes_Http_Requests__test_multiple_requests__1.yml b/tests/testing/concerns/__snapshots__/Test_Makes_Http_Requests__test_multiple_requests__1.yml deleted file mode 100644 index a0cd6f38..00000000 --- a/tests/testing/concerns/__snapshots__/Test_Makes_Http_Requests__test_multiple_requests__1.yml +++ /dev/null @@ -1,3 +0,0 @@ -- 1 -- 2 -- 3 From 0e914c2d5d3bac938cc321f732a4bd98a18a5148 Mon Sep 17 00:00:00 2001 From: Sean Fisher Date: Mon, 20 Nov 2023 10:28:48 -0500 Subject: [PATCH 22/26] Fix fixtures --- tests/{Includes => includes}/fixtures/test.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/{Includes => includes}/fixtures/test.txt (100%) diff --git a/tests/Includes/fixtures/test.txt b/tests/includes/fixtures/test.txt similarity index 100% rename from tests/Includes/fixtures/test.txt rename to tests/includes/fixtures/test.txt From 0af848e46f4d85e33cee9f2fc1f48262c0eb5792 Mon Sep 17 00:00:00 2001 From: Sean Fisher Date: Mon, 20 Nov 2023 10:29:22 -0500 Subject: [PATCH 23/26] Removing blocks --- tests/Framework/Blocks/BlockProviderTest.php | 76 ------------------- .../fixtures/blocks/class-mock-block.php | 21 ----- .../fixtures/dummy/class-example-block.php | 16 ---- 3 files changed, 113 deletions(-) delete mode 100644 tests/Framework/Blocks/BlockProviderTest.php delete mode 100644 tests/Framework/Blocks/fixtures/blocks/class-mock-block.php delete mode 100644 tests/Framework/Blocks/fixtures/dummy/class-example-block.php diff --git a/tests/Framework/Blocks/BlockProviderTest.php b/tests/Framework/Blocks/BlockProviderTest.php deleted file mode 100644 index f547647e..00000000 --- a/tests/Framework/Blocks/BlockProviderTest.php +++ /dev/null @@ -1,76 +0,0 @@ -app->set_app_path( dirname( __DIR__, 2 ) ); - - $this->app['config']->set( 'app.namespace', 'Mantle\\Tests' ); - } - - protected function tearDown(): void { - $this->app['config']->set( 'app.namespace', 'App' ); - $this->app->set_app_path( $this->app->get_base_path( 'app' ) ); - - parent::tearDown(); - } - - /** - * Verify that the Discover_Blocks::within method returns the expected - * array of block class names. - */ - public function testBlocksAreFound() { - $this->assertEquals( 'Mantle\\Tests', $this->app->get_namespace() ); - - $expected = [ - Example_Block::class, - ]; - - $found_blocks = Discover_Blocks::within( - __DIR__ . '/fixtures/dummy', - getcwd(), - ); - - $this->assertSame( $expected, $found_blocks ); - } - - /** - * Verify that the Block Service Provider locates, and registers, blocks - * as expected. - */ - public function testBlockProviderRegistersBlocks() { - $expected = 1; - - /** - * First we need to configure the test application so it will find the blocks - * inside of our fixtures folder, and load them as if this were the Mantle app. - */ - $app = m::mock( Application::class )->makePartial(); - $app->set_base_path( getcwd() ); - $app->set_app_path( __DIR__ . '/fixtures' ); - - $app['config'] = $this->app['config']; - - $this->assertEquals( 'Mantle\\Tests', $app->get_namespace() ); - - /** - * Now we need to boot our test application. - */ - $app->register( Block_Service_Provider::class ); - $app->boot(); - - $this->assertSame( $expected, Mock_Block::$registrations ); - } -} diff --git a/tests/Framework/Blocks/fixtures/blocks/class-mock-block.php b/tests/Framework/Blocks/fixtures/blocks/class-mock-block.php deleted file mode 100644 index eaac44be..00000000 --- a/tests/Framework/Blocks/fixtures/blocks/class-mock-block.php +++ /dev/null @@ -1,21 +0,0 @@ - Date: Mon, 20 Nov 2023 10:31:08 -0500 Subject: [PATCH 24/26] PHPstan fixes --- src/mantle/testing/concerns/trait-reads-annotations.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mantle/testing/concerns/trait-reads-annotations.php b/src/mantle/testing/concerns/trait-reads-annotations.php index f1f1d6bf..6d64df2a 100644 --- a/src/mantle/testing/concerns/trait-reads-annotations.php +++ b/src/mantle/testing/concerns/trait-reads-annotations.php @@ -29,10 +29,10 @@ public function get_annotations_for_method(): array { } // Use the PHPUnit ^9.5 method if available. - if ( method_exists( Test::class, 'parseTestMethodAnnotations' ) ) { + if ( method_exists( Test::class, 'parseTestMethodAnnotations' ) ) { // @phpstan-ignore-line return Test::parseTestMethodAnnotations( static::class, - $this->getName() + $this->getName(), // @phpstan-ignore-line ); } From 6716f295aabdfbf7ab64dd1a8612916d36f0c21c Mon Sep 17 00:00:00 2001 From: Sean Fisher Date: Mon, 20 Nov 2023 10:34:19 -0500 Subject: [PATCH 25/26] Ensure the class is loaded --- tests/Framework/Events/DiscoverEventsTest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/Framework/Events/DiscoverEventsTest.php b/tests/Framework/Events/DiscoverEventsTest.php index 9840ee7b..f98e1f1f 100644 --- a/tests/Framework/Events/DiscoverEventsTest.php +++ b/tests/Framework/Events/DiscoverEventsTest.php @@ -17,6 +17,10 @@ protected function setUp(): void { // Mock a true Mantle application. $this->app['config']->set( 'app.namespace', 'Mantle\\Tests' ); $this->app->set_app_path( dirname( __DIR__, 2 ) ); + + require_once __DIR__ . '/fixtures/listeners/class-example-listener.php'; + require_once __DIR__ . '/fixtures/events/class-event-one.php'; + require_once __DIR__ . '/fixtures/events/class-event-two.php'; } protected function tearDown(): void { From 3de3e774f9d5c749f3ef3bb5a56eb8c9d4b5282e Mon Sep 17 00:00:00 2001 From: Sean Fisher Date: Mon, 20 Nov 2023 10:43:12 -0500 Subject: [PATCH 26/26] Lock in 3.6.9 --- composer.json | 2 +- phpunit.xml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 107e0c5c..e088cc7e 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ "league/flysystem-cached-adapter": "^1.1", "monolog/monolog": "^2.9.1", "nesbot/carbon": "^2.68.1", - "nette/php-generator": "^3.6", + "nette/php-generator": "^3.6.9", "nunomaduro/collision": "^6.0 || ^7.0", "nunomaduro/termwind": "^1.15.1", "psr/container": "^1.1.1 || ^2.0.2", diff --git a/phpunit.xml b/phpunit.xml index 730c58b4..397400ca 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -5,7 +5,6 @@ backupGlobals="false" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.3/phpunit.xsd" - cacheDirectory=".phpunit.cache" >