$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/test-faker.php b/tests/FakerTest.php
similarity index 96%
rename from tests/test-faker.php
rename to tests/FakerTest.php
index daf2cf2f..ce37c605 100644
--- a/tests/test-faker.php
+++ b/tests/FakerTest.php
@@ -4,7 +4,7 @@
use Faker\Factory;
use Mantle\Faker\Faker_Provider;
-class Test_Faker extends \PHPUnit\Framework\TestCase {
+class FakerTest extends \PHPUnit\Framework\TestCase {
/**
* @var Factory
*/
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/events/test-discover-events.php b/tests/Framework/Events/DiscoverEventsTest.php
similarity index 88%
rename from tests/framework/events/test-discover-events.php
rename to tests/Framework/Events/DiscoverEventsTest.php
index 5b477963..f98e1f1f 100644
--- a/tests/framework/events/test-discover-events.php
+++ b/tests/Framework/Events/DiscoverEventsTest.php
@@ -10,13 +10,17 @@
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();
// 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 {
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/test-nullable-comment-objects-test-case.php b/tests/Framework/Helpers/NullableCommentObjectsTestCaseTest.php
similarity index 93%
rename from tests/framework/helpers/test-nullable-comment-objects-test-case.php
rename to tests/Framework/Helpers/NullableCommentObjectsTestCaseTest.php
index df799067..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 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 95%
rename from tests/framework/helpers/test-nullable-post-objects-test-case.php
rename to tests/Framework/Helpers/NullablePostObjectsTestCaseTest.php
index f96a7098..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 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 98%
rename from tests/framework/helpers/test-nullable-term-objects-test-case.php
rename to tests/Framework/Helpers/NullableTermObjectsTestCaseTest.php
index 1e7c0493..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 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 49447ab0..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 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/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 100%
rename from tests/framework/test-pipeline.php
rename to tests/Framework/PipelineTest.php
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 9cefe50f..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 SupportHelpersArrayTest 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 449f830b..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 SupportHelpersGeneralTest 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/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/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/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-client/test-http-client.php b/tests/HttpClient/HttpClientTest.php
similarity index 99%
rename from tests/http-client/test-http-client.php
rename to tests/HttpClient/HttpClientTest.php
index 9a2642ce..3a3cd9bb 100644
--- a/tests/http-client/test-http-client.php
+++ b/tests/HttpClient/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/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..76079491 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
*/
@@ -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);
@@ -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 8ff8d366..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 Forward_CallsTest 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/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 1eb246bd..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_Service_Provider extends MockeryTestCase {
+class ModelRegisterProviderTest extends MockeryTestCase {
protected function setUp(): void {
parent::setUp();
remove_all_actions( 'init' );
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/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 = '
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 93%
rename from tests/testing/concerns/test-interacts-with-console.php
rename to tests/Testing/Concerns/InteractsWithConsoleTest.php
index f1d8061d..d19a1796 100644
--- a/tests/testing/concerns/test-interacts-with-console.php
+++ b/tests/Testing/Concerns/InteractsWithConsoleTest.php
@@ -1,5 +1,5 @@
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 90%
rename from tests/testing/concerns/test-wordpress-authentication.php
rename to tests/Testing/Concerns/WordPressAuthenticationTest.php
index 1db897a3..252035ec 100644
--- a/tests/testing/concerns/test-wordpress-authentication.php
+++ b/tests/Testing/Concerns/WordPressAuthenticationTest.php
@@ -1,5 +1,5 @@
acting_as( 'administrator' );
diff --git a/tests/testing/concerns/__snapshots__/Test_Makes_Http_Requests__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__/Test_Makes_Http_Requests__test_match_snapshot__1.yml
rename to tests/Testing/Concerns/__snapshots__/MakesHttpRequestsTest__test_match_snapshot__1.yml
diff --git a/tests/testing/concerns/__snapshots__/Test_Makes_Http_Requests__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__/Test_Makes_Http_Requests__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__/Test_Makes_Http_Requests__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__/Test_Makes_Http_Requests__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__/Test_Makes_Http_Requests__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__/Test_Makes_Http_Requests__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__/Test_Makes_Http_Requests__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__/Test_Makes_Http_Requests__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__/Test_Makes_Http_Requests__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__/Test_Makes_Http_Requests__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__/Test_Makes_Http_Requests__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__/Test_Makes_Http_Requests__test_multiple_requests__1.yml
rename to tests/Testing/Concerns/__snapshots__/MakesHttpRequestsTest__test_multiple_requests__1.yml
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 62%
rename from tests/testing/test-with-faker.php
rename to tests/Testing/WithFakerTest.php
index f08f97d6..8b950906 100644
--- a/tests/testing/test-with-faker.php
+++ b/tests/Testing/WithFakerTest.php
@@ -1,10 +1,11 @@
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/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/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/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 1eb2b43e..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_Views 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();
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 @@
-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/helpers/test-nullable-site-objects-test-case.php b/tests/framework/helpers/test-nullable-site-objects-test-case.php
deleted file mode 100644
index 7f805d5e..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 );
- }
- }
-}