diff --git a/tests/Assets/Serializers/ArrayableEntity.php b/tests/Assets/Serializers/ArrayableEntity.php new file mode 100644 index 00000000..805971d9 --- /dev/null +++ b/tests/Assets/Serializers/ArrayableEntity.php @@ -0,0 +1,31 @@ +id; + } + + public function getName() + { + return $this->name; + } + + public function getList() + { + return $this->list; + } +} diff --git a/tests/Assets/Serializers/JsonableEntity.php b/tests/Assets/Serializers/JsonableEntity.php new file mode 100644 index 00000000..6a04415b --- /dev/null +++ b/tests/Assets/Serializers/JsonableEntity.php @@ -0,0 +1,31 @@ +id; + } + + public function getName() + { + return $this->name; + } + + public function getNumeric() + { + return $this->numeric; + } +} diff --git a/tests/Feature/Auth/DoctrineUserProviderTest.php b/tests/Feature/Auth/DoctrineUserProviderTest.php index ffda1daa..3b64d0b7 100644 --- a/tests/Feature/Auth/DoctrineUserProviderTest.php +++ b/tests/Feature/Auth/DoctrineUserProviderTest.php @@ -8,9 +8,9 @@ use LaravelDoctrine\ORM\Auth\DoctrineUserProvider; use LaravelDoctrineTest\ORM\Assets\Auth\AuthenticableMock; use LaravelDoctrineTest\ORM\Assets\Auth\AuthenticableWithNonEmptyConstructorMock; +use LaravelDoctrineTest\ORM\TestCase; use Mockery as m; use Mockery\Mock; -use PHPUnit\Framework\TestCase; class DoctrineUserProviderTest extends TestCase { @@ -55,6 +55,8 @@ protected function setUp(): void $this->em, AuthenticableWithNonEmptyConstructorMock::class ); + + parent::setUp(); } public function test_can_retrieve_by_id() @@ -189,5 +191,7 @@ protected function mockGetRepository($class = AuthenticableMock::class) protected function tearDown(): void { m::close(); + + parent::tearDown(); } } diff --git a/tests/Feature/Auth/Passwords/DoctrineTokenRepositoryTest.php b/tests/Feature/Auth/Passwords/DoctrineTokenRepositoryTest.php index b59bd44b..aec6c1fb 100644 --- a/tests/Feature/Auth/Passwords/DoctrineTokenRepositoryTest.php +++ b/tests/Feature/Auth/Passwords/DoctrineTokenRepositoryTest.php @@ -9,9 +9,9 @@ use Illuminate\Contracts\Hashing\Hasher; use LaravelDoctrine\ORM\Auth\Passwords\DoctrineTokenRepository; use LaravelDoctrineTest\ORM\Assets\Auth\Passwords\UserMock; +use LaravelDoctrineTest\ORM\TestCase; use Mockery as m; use Mockery\Mock; -use PHPUnit\Framework\TestCase; class DoctrineTokenRepositoryTest extends TestCase { @@ -66,6 +66,8 @@ protected function setUp(): void 'hashkey', 60 ); + + parent::setUp(); } public function test_can_create_a_token() @@ -274,5 +276,7 @@ public function test_can_delete_expired() protected function tearDown(): void { m::close(); + + parent::tearDown(); } } diff --git a/tests/Feature/Configuration/Cache/AbstractCacheProviderTest.php b/tests/Feature/Configuration/Cache/AbstractCacheProviderTest.php index 3b608496..4095da32 100644 --- a/tests/Feature/Configuration/Cache/AbstractCacheProviderTest.php +++ b/tests/Feature/Configuration/Cache/AbstractCacheProviderTest.php @@ -2,8 +2,8 @@ namespace LaravelDoctrineTest\ORM\Feature\Configuration\Cache; +use LaravelDoctrineTest\ORM\TestCase; use Mockery; -use PHPUnit\Framework\TestCase; abstract class AbstractCacheProviderTest extends TestCase { @@ -19,5 +19,7 @@ public function test_can_resolve() public function tearDown(): void { Mockery::close(); + + parent::tearDown(); } } diff --git a/tests/Feature/Configuration/Cache/CacheManagerTest.php b/tests/Feature/Configuration/Cache/CacheManagerTest.php index e8fcb24a..35e505b0 100644 --- a/tests/Feature/Configuration/Cache/CacheManagerTest.php +++ b/tests/Feature/Configuration/Cache/CacheManagerTest.php @@ -9,8 +9,8 @@ use LaravelDoctrine\ORM\Configuration\Cache\CacheManager; use LaravelDoctrine\ORM\Configuration\Cache\FileCacheProvider; use LaravelDoctrine\ORM\Exceptions\DriverNotFound; +use LaravelDoctrineTest\ORM\TestCase; use Mockery as m; -use PHPUnit\Framework\TestCase; use Symfony\Component\Cache\Adapter\ArrayAdapter; class CacheManagerTest extends TestCase @@ -39,6 +39,8 @@ protected function setUp(): void $this->manager = new CacheManager( $this->app ); + + parent::setUp(); } public function test_driver_returns_the_default_driver() @@ -98,5 +100,7 @@ public function test_can_replace_an_existing_driver() protected function tearDown(): void { m::close(); + + parent::tearDown(); } } diff --git a/tests/Feature/Configuration/Cache/IlluminateCacheProviderTest.php b/tests/Feature/Configuration/Cache/IlluminateCacheProviderTest.php index 979fdce2..5759fe9d 100644 --- a/tests/Feature/Configuration/Cache/IlluminateCacheProviderTest.php +++ b/tests/Feature/Configuration/Cache/IlluminateCacheProviderTest.php @@ -6,8 +6,8 @@ use Illuminate\Contracts\Cache\Factory; use Illuminate\Contracts\Cache\Repository; use LaravelDoctrine\ORM\Configuration\Cache\IlluminateCacheProvider; +use LaravelDoctrineTest\ORM\TestCase; use Mockery as m; -use PHPUnit\Framework\TestCase; class IlluminateCacheProviderTest extends TestCase { @@ -32,6 +32,8 @@ protected function setUp(): void ->andReturn($this->repository); $this->driver = new IlluminateCacheProvider($manager); + + parent::setUp(); } public function test_driver_returns_provided_namespace(): void @@ -61,5 +63,7 @@ public function test_driver_has_no_namespace_by_default(): void public function tearDown(): void { m::close(); + + parent::tearDown(); } } diff --git a/tests/Feature/Configuration/Cache/PhpFileCacheProviderTest.php b/tests/Feature/Configuration/Cache/PhpFileCacheProviderTest.php index 8dccde6f..d1d35436 100644 --- a/tests/Feature/Configuration/Cache/PhpFileCacheProviderTest.php +++ b/tests/Feature/Configuration/Cache/PhpFileCacheProviderTest.php @@ -32,12 +32,3 @@ public function getExpectedInstance() return PhpFilesAdapter::class; } } - -if(!function_exists('storage_path')) { - function storage_path($path = null) - { - $storage = __DIR__ . DIRECTORY_SEPARATOR . '../../Stubs/storage'; - - return is_null($path) ? $storage : $storage . DIRECTORY_SEPARATOR . $path; - } -} diff --git a/tests/Feature/Configuration/Connections/ConnectionManagerTest.php b/tests/Feature/Configuration/Connections/ConnectionManagerTest.php index 57e243c5..8a56a594 100644 --- a/tests/Feature/Configuration/Connections/ConnectionManagerTest.php +++ b/tests/Feature/Configuration/Connections/ConnectionManagerTest.php @@ -8,8 +8,8 @@ use LaravelDoctrine\ORM\Configuration\Connections\MysqlConnection; use LaravelDoctrine\ORM\Configuration\Connections\SqliteConnection; use LaravelDoctrine\ORM\Exceptions\DriverNotFound; +use LaravelDoctrineTest\ORM\TestCase; use Mockery as m; -use PHPUnit\Framework\TestCase; class ConnectionManagerTest extends TestCase { @@ -39,6 +39,8 @@ protected function setUp(): void $this->manager = new ConnectionManager( $this->app ); + + parent::setUp(); } public function test_driver_returns_the_default_driver() @@ -99,5 +101,7 @@ public function test_can_replace_an_existing_driver() protected function tearDown(): void { m::close(); + + parent::tearDown(); } } diff --git a/tests/Feature/Configuration/Connections/MysqlConnectionTest.php b/tests/Feature/Configuration/Connections/MysqlConnectionTest.php index 1d652e22..3ef507dc 100644 --- a/tests/Feature/Configuration/Connections/MysqlConnectionTest.php +++ b/tests/Feature/Configuration/Connections/MysqlConnectionTest.php @@ -4,9 +4,9 @@ use Illuminate\Contracts\Config\Repository; use LaravelDoctrine\ORM\Configuration\Connections\MysqlConnection; +use LaravelDoctrineTest\ORM\TestCase; use Mockery as m; use Mockery\Mock; -use PHPUnit\Framework\TestCase; class MysqlConnectionTest extends TestCase { @@ -25,6 +25,8 @@ protected function setUp(): void $this->config = m::mock(Repository::class); $this->connection = new MysqlConnection($this->config); + + parent::setUp(); } public function test_can_resolve() @@ -69,5 +71,7 @@ public function test_can_resolve() protected function tearDown(): void { m::close(); + + parent::tearDown(); } } diff --git a/tests/Feature/Configuration/Connections/OracleConnectionTest.php b/tests/Feature/Configuration/Connections/OracleConnectionTest.php index 2bf9d124..0316676f 100644 --- a/tests/Feature/Configuration/Connections/OracleConnectionTest.php +++ b/tests/Feature/Configuration/Connections/OracleConnectionTest.php @@ -4,9 +4,9 @@ use Illuminate\Contracts\Config\Repository; use LaravelDoctrine\ORM\Configuration\Connections\OracleConnection; +use LaravelDoctrineTest\ORM\TestCase; use Mockery as m; use Mockery\Mock; -use PHPUnit\Framework\TestCase; class OracleConnectionTest extends TestCase { @@ -25,6 +25,8 @@ protected function setUp(): void $this->config = m::mock(Repository::class); $this->connection = new OracleConnection($this->config); + + parent::setUp(); } public function test_can_resolve() @@ -57,5 +59,7 @@ public function test_can_resolve() protected function tearDown(): void { m::close(); + + parent::tearDown(); } } diff --git a/tests/Feature/Configuration/Connections/PgsqlConnectionTest.php b/tests/Feature/Configuration/Connections/PgsqlConnectionTest.php index 3634c7fd..9dd2614c 100644 --- a/tests/Feature/Configuration/Connections/PgsqlConnectionTest.php +++ b/tests/Feature/Configuration/Connections/PgsqlConnectionTest.php @@ -4,9 +4,9 @@ use Illuminate\Contracts\Config\Repository; use LaravelDoctrine\ORM\Configuration\Connections\PgsqlConnection; +use LaravelDoctrineTest\ORM\TestCase; use Mockery as m; use Mockery\Mock; -use PHPUnit\Framework\TestCase; class PgsqlConnectionTest extends TestCase { @@ -25,6 +25,8 @@ protected function setUp(): void $this->config = m::mock(Repository::class); $this->connection = new PgsqlConnection($this->config); + + parent::setUp(); } public function test_can_resolve() @@ -69,5 +71,7 @@ public function test_can_resolve() protected function tearDown(): void { m::close(); + + parent::tearDown(); } } diff --git a/tests/Feature/Configuration/Connections/PrimaryReadReplicaConnectionTest.php b/tests/Feature/Configuration/Connections/PrimaryReadReplicaConnectionTest.php index f8f6cf5c..74586515 100644 --- a/tests/Feature/Configuration/Connections/PrimaryReadReplicaConnectionTest.php +++ b/tests/Feature/Configuration/Connections/PrimaryReadReplicaConnectionTest.php @@ -5,8 +5,8 @@ use Doctrine\DBAL\Connections\PrimaryReadReplicaConnection as PrimaryReadReplicaDoctrineWrapper; use Illuminate\Contracts\Config\Repository; use LaravelDoctrine\ORM\Configuration\Connections\PrimaryReadReplicaConnection; +use LaravelDoctrineTest\ORM\TestCase; use Mockery as m; -use PHPUnit\Framework\TestCase; /** * Basic unit tests for primary read-replica connection @@ -18,6 +18,8 @@ protected function setUp(): void if (!class_exists(PrimaryReadReplicaDoctrineWrapper::class)) { $this->markTestSkipped('Skipped for doctrine/dbal < 2.11'); } + + parent::setUp(); } /** diff --git a/tests/Feature/Configuration/Connections/SqliteConnectionTest.php b/tests/Feature/Configuration/Connections/SqliteConnectionTest.php index 9ac18210..2f6b2e88 100644 --- a/tests/Feature/Configuration/Connections/SqliteConnectionTest.php +++ b/tests/Feature/Configuration/Connections/SqliteConnectionTest.php @@ -4,9 +4,9 @@ use Illuminate\Contracts\Config\Repository; use LaravelDoctrine\ORM\Configuration\Connections\SqliteConnection; +use LaravelDoctrineTest\ORM\TestCase; use Mockery as m; use Mockery\Mock; -use PHPUnit\Framework\TestCase; class SqliteConnectionTest extends TestCase { @@ -25,6 +25,8 @@ protected function setUp(): void $this->config = m::mock(Repository::class); $this->connection = new SqliteConnection($this->config); + + parent::setUp(); } public function test_can_resolve() @@ -80,5 +82,7 @@ public function test_can_resolve_with_full_in__memory_database() protected function tearDown(): void { m::close(); + + parent::tearDown(); } } diff --git a/tests/Feature/Configuration/Connections/SqlsrvConnectionTest.php b/tests/Feature/Configuration/Connections/SqlsrvConnectionTest.php index a0948ab3..73cf9eed 100644 --- a/tests/Feature/Configuration/Connections/SqlsrvConnectionTest.php +++ b/tests/Feature/Configuration/Connections/SqlsrvConnectionTest.php @@ -4,9 +4,9 @@ use Illuminate\Contracts\Config\Repository; use LaravelDoctrine\ORM\Configuration\Connections\SqlsrvConnection; +use LaravelDoctrineTest\ORM\TestCase; use Mockery as m; use Mockery\Mock; -use PHPUnit\Framework\TestCase; class SqlsrvConnectionTest extends TestCase { @@ -25,6 +25,8 @@ protected function setUp(): void $this->config = m::mock(Repository::class); $this->connection = new SqlsrvConnection($this->config); + + parent::setUp(); } public function test_can_resolve() @@ -57,5 +59,7 @@ public function test_can_resolve() protected function tearDown(): void { m::close(); + + parent::tearDown(); } } diff --git a/tests/Feature/Configuration/CustomTypeManagerTest.php b/tests/Feature/Configuration/CustomTypeManagerTest.php index e8832e61..b9493c04 100644 --- a/tests/Feature/Configuration/CustomTypeManagerTest.php +++ b/tests/Feature/Configuration/CustomTypeManagerTest.php @@ -6,7 +6,7 @@ use LaravelDoctrine\ORM\Configuration\CustomTypeManager; use LaravelDoctrineTest\ORM\Assets\Configuration\TypeMock; use LaravelDoctrineTest\ORM\Assets\Configuration\TypeMock2; -use PHPUnit\Framework\TestCase; +use LaravelDoctrineTest\ORM\TestCase; class CustomTypeManagerTest extends TestCase { diff --git a/tests/Feature/Configuration/LaravelNamingStrategyTest.php b/tests/Feature/Configuration/LaravelNamingStrategyTest.php index e9f63a8d..595e8af8 100644 --- a/tests/Feature/Configuration/LaravelNamingStrategyTest.php +++ b/tests/Feature/Configuration/LaravelNamingStrategyTest.php @@ -4,7 +4,7 @@ use Illuminate\Support\Str; use LaravelDoctrine\ORM\Configuration\LaravelNamingStrategy; -use PHPUnit\Framework\TestCase; +use LaravelDoctrineTest\ORM\TestCase; class LaravelNamingStrategyTest extends TestCase { @@ -16,6 +16,8 @@ class LaravelNamingStrategyTest extends TestCase public function setUp(): void { $this->strategy = new LaravelNamingStrategy(new Str()); + + parent::setUp(); } public function test_class_to_table_name() diff --git a/tests/Feature/Configuration/MetaData/AttributesTest.php b/tests/Feature/Configuration/MetaData/AttributesTest.php index af0e6765..8dcb81fd 100644 --- a/tests/Feature/Configuration/MetaData/AttributesTest.php +++ b/tests/Feature/Configuration/MetaData/AttributesTest.php @@ -4,8 +4,8 @@ use LaravelDoctrine\ORM\Configuration\MetaData\Attributes; use Doctrine\Persistence\Mapping\Driver\MappingDriver; +use LaravelDoctrineTest\ORM\TestCase; use Mockery as m; -use PHPUnit\Framework\TestCase; class AttributesTest extends TestCase { @@ -17,6 +17,8 @@ class AttributesTest extends TestCase protected function setUp(): void { $this->meta = new Attributes(); + + parent::setUp(); } public function test_can_resolve() @@ -34,5 +36,7 @@ public function test_can_resolve() protected function tearDown(): void { m::close(); + + parent::tearDown(); } } diff --git a/tests/Feature/Configuration/MetaData/MetaDataManagerTest.php b/tests/Feature/Configuration/MetaData/MetaDataManagerTest.php index d3f7d396..fbbd16a4 100644 --- a/tests/Feature/Configuration/MetaData/MetaDataManagerTest.php +++ b/tests/Feature/Configuration/MetaData/MetaDataManagerTest.php @@ -6,8 +6,8 @@ use Illuminate\Contracts\Container\Container; use LaravelDoctrine\ORM\Configuration\MetaData\MetaDataManager; use LaravelDoctrine\ORM\Exceptions\DriverNotFound; +use LaravelDoctrineTest\ORM\TestCase; use Mockery as m; -use PHPUnit\Framework\TestCase; class MetaDataManagerTest extends TestCase { @@ -29,6 +29,8 @@ protected function setUp(): void $this->manager = new MetaDataManager( $this->app ); + + parent::setUp(); } public function test_driver_returns_the_default_driver() @@ -74,5 +76,7 @@ public function test_can_replace_an_existing_driver() protected function tearDown(): void { m::close(); + + parent::tearDown(); } } diff --git a/tests/Feature/Configuration/MetaData/PhpTest.php b/tests/Feature/Configuration/MetaData/PhpTest.php index f11f6222..70d9710c 100644 --- a/tests/Feature/Configuration/MetaData/PhpTest.php +++ b/tests/Feature/Configuration/MetaData/PhpTest.php @@ -5,8 +5,8 @@ use Doctrine\Persistence\Mapping\Driver\MappingDriver; use Doctrine\Persistence\Mapping\Driver\PHPDriver; use LaravelDoctrine\ORM\Configuration\MetaData\Php; +use LaravelDoctrineTest\ORM\TestCase; use Mockery as m; -use PHPUnit\Framework\TestCase; class PhpTest extends TestCase { @@ -18,6 +18,8 @@ class PhpTest extends TestCase protected function setUp(): void { $this->meta = new Php(); + + parent::setUp(); } public function test_can_resolve() @@ -35,5 +37,7 @@ public function test_can_resolve() protected function tearDown(): void { m::close(); + + parent::tearDown(); } } diff --git a/tests/Feature/Configuration/MetaData/SimplifiedXmlTest.php b/tests/Feature/Configuration/MetaData/SimplifiedXmlTest.php index e9571aa5..e2edf9e1 100644 --- a/tests/Feature/Configuration/MetaData/SimplifiedXmlTest.php +++ b/tests/Feature/Configuration/MetaData/SimplifiedXmlTest.php @@ -5,8 +5,8 @@ use Doctrine\ORM\Mapping\Driver\SimplifiedXmlDriver; use Doctrine\Persistence\Mapping\Driver\MappingDriver; use LaravelDoctrine\ORM\Configuration\MetaData\SimplifiedXml; +use LaravelDoctrineTest\ORM\TestCase; use Mockery as m; -use PHPUnit\Framework\TestCase; class SimplifiedXmlTest extends TestCase { @@ -18,6 +18,8 @@ class SimplifiedXmlTest extends TestCase protected function setUp(): void { $this->meta = new SimplifiedXml(); + + parent::setUp(); } public function test_can_resolve() @@ -36,5 +38,7 @@ public function test_can_resolve() protected function tearDown(): void { m::close(); + + parent::tearDown(); } } diff --git a/tests/Feature/Configuration/MetaData/StaticPhpTest.php b/tests/Feature/Configuration/MetaData/StaticPhpTest.php index 6ff7ce71..122dd35e 100644 --- a/tests/Feature/Configuration/MetaData/StaticPhpTest.php +++ b/tests/Feature/Configuration/MetaData/StaticPhpTest.php @@ -5,8 +5,8 @@ use Doctrine\Persistence\Mapping\Driver\MappingDriver; use Doctrine\Persistence\Mapping\Driver\StaticPHPDriver; use LaravelDoctrine\ORM\Configuration\MetaData\StaticPhp; +use LaravelDoctrineTest\ORM\TestCase; use Mockery as m; -use PHPUnit\Framework\TestCase; class StaticPhpTest extends TestCase { @@ -18,6 +18,8 @@ class StaticPhpTest extends TestCase protected function setUp(): void { $this->meta = new StaticPhp(); + + parent::setUp(); } public function test_can_resolve() @@ -35,5 +37,7 @@ public function test_can_resolve() protected function tearDown(): void { m::close(); + + parent::tearDown(); } } diff --git a/tests/Feature/Configuration/MetaData/XmlTest.php b/tests/Feature/Configuration/MetaData/XmlTest.php index 2991ba5e..a393732c 100644 --- a/tests/Feature/Configuration/MetaData/XmlTest.php +++ b/tests/Feature/Configuration/MetaData/XmlTest.php @@ -5,8 +5,8 @@ use Doctrine\ORM\Mapping\Driver\XmlDriver; use Doctrine\Persistence\Mapping\Driver\MappingDriver; use LaravelDoctrine\ORM\Configuration\MetaData\Xml; +use LaravelDoctrineTest\ORM\TestCase; use Mockery as m; -use PHPUnit\Framework\TestCase; class XmlTest extends TestCase { @@ -18,6 +18,8 @@ class XmlTest extends TestCase protected function setUp(): void { $this->meta = new Xml(); + + parent::setUp(); } public function test_can_resolve() @@ -54,5 +56,7 @@ public function test_can_not_specify_extension_without_error() protected function tearDown(): void { m::close(); + + parent::tearDown(); } } diff --git a/tests/Feature/DoctrineManagerTest.php b/tests/Feature/DoctrineManagerTest.php index fef62bc6..9229ad06 100644 --- a/tests/Feature/DoctrineManagerTest.php +++ b/tests/Feature/DoctrineManagerTest.php @@ -14,8 +14,8 @@ use LaravelDoctrine\ORM\DoctrineManager; use LaravelDoctrine\ORM\EntityManagerFactory; use LaravelDoctrine\ORM\Extensions\MappingDriverChain; +use LaravelDoctrineTest\ORM\TestCase; use Mockery as m; -use PHPUnit\Framework\TestCase; class DoctrineManagerTest extends TestCase { @@ -54,6 +54,8 @@ protected function setUp(): void $this->manager = new DoctrineManager( $this->container ); + + parent::setUp(); } public function test_can_extend_doctrine_on_existing_connection_with_callback() @@ -185,6 +187,8 @@ protected function tearDown(): void { m::close(); BootChain::flush(); + + parent::tearDown(); } public function assertExtendedCorrectly($configuration, $connection, $eventManager) diff --git a/tests/Feature/EntityManagerFactoryTest.php b/tests/Feature/EntityManagerFactoryTest.php index 3f11cdc9..7985c456 100644 --- a/tests/Feature/EntityManagerFactoryTest.php +++ b/tests/Feature/EntityManagerFactoryTest.php @@ -32,9 +32,9 @@ use LaravelDoctrineTest\ORM\Assets\FilterStub; use LaravelDoctrineTest\ORM\Assets\ListenerStub; use LaravelDoctrineTest\ORM\Assets\SubscriberStub; +use LaravelDoctrineTest\ORM\TestCase; use Mockery as m; use Mockery\Mock; -use PHPUnit\Framework\TestCase; use Psr\Cache\CacheItemPoolInterface; use ReflectionException; use ReflectionObject; @@ -130,6 +130,8 @@ protected function setUp(): void $this->config, $this->listenerResolver ); + + parent::setUp(); } protected function assertEntityManager(EntityManagerInterface $manager) @@ -1181,6 +1183,8 @@ public function testPrimaryReadReplicaConnection( protected function tearDown(): void { m::close(); + + parent::tearDown(); } /** diff --git a/tests/Feature/Extensions/ExtensionManagerTest.php b/tests/Feature/Extensions/ExtensionManagerTest.php index 5b2cfeeb..54c801e1 100644 --- a/tests/Feature/Extensions/ExtensionManagerTest.php +++ b/tests/Feature/Extensions/ExtensionManagerTest.php @@ -13,9 +13,9 @@ use LaravelDoctrineTest\ORM\Assets\Extensions\ExtensionMock; use LaravelDoctrineTest\ORM\Assets\Extensions\ExtensionMock2; use LaravelDoctrineTest\ORM\Assets\Extensions\ExtensionWithFiltersMock; +use LaravelDoctrineTest\ORM\TestCase; use Mockery as m; use Mockery\Mock; -use PHPUnit\Framework\TestCase; class ExtensionManagerTest extends TestCase { @@ -64,6 +64,8 @@ protected function setUp(): void $this->driver = m::mock(XmlDriver::class); $this->manager = $this->newManager(); + + parent::setUp(); } public function test_register_extension() @@ -199,6 +201,8 @@ protected function tearDown(): void m::close(); $this->manager = $this->newManager(); + + parent::tearDown(); } protected function newManager() diff --git a/tests/Feature/Extensions/MappingDriverChainTest.php b/tests/Feature/Extensions/MappingDriverChainTest.php index 0da97cbe..4c1b0042 100644 --- a/tests/Feature/Extensions/MappingDriverChainTest.php +++ b/tests/Feature/Extensions/MappingDriverChainTest.php @@ -7,9 +7,9 @@ use Doctrine\Persistence\Mapping\Driver\DefaultFileLocator; use Doctrine\Persistence\Mapping\Driver\SymfonyFileLocator; use LaravelDoctrine\ORM\Extensions\MappingDriverChain; +use LaravelDoctrineTest\ORM\TestCase; use Mockery as m; use Mockery\Mock; -use PHPUnit\Framework\TestCase; /** * NOTE: This test was degraded while refactoring for ORM 3. @@ -30,6 +30,8 @@ protected function setUp(): void { $this->driver = m::mock(XmlDriver::class); $this->chain = new MappingDriverChain($this->driver, 'Namespace'); + + parent::setUp(); } public function test_get_default_driver() @@ -99,5 +101,7 @@ public function test_can_add_paths_to_simplified_filedriver() protected function tearDown(): void { m::close(); + + parent::tearDown(); } } diff --git a/tests/Feature/IlluminateRegistryTest.php b/tests/Feature/IlluminateRegistryTest.php index 37d4829d..cdd8b64d 100644 --- a/tests/Feature/IlluminateRegistryTest.php +++ b/tests/Feature/IlluminateRegistryTest.php @@ -9,9 +9,9 @@ use InvalidArgumentException; use LaravelDoctrine\ORM\EntityManagerFactory; use LaravelDoctrine\ORM\IlluminateRegistry; +use LaravelDoctrineTest\ORM\TestCase; use Mockery as m; use Mockery\Mock; -use PHPUnit\Framework\TestCase; use RuntimeException; use stdClass; @@ -41,6 +41,8 @@ protected function setUp(): void $this->container, $this->factory ); + + parent::setUp(); } public function test_can_add_manager() @@ -560,5 +562,7 @@ public function test_get_manager_after_reset_should_return_new_manager() protected function tearDown(): void { m::close(); + + parent::tearDown(); } } diff --git a/tests/Feature/Middleware/SubstituteBindingsTest.php b/tests/Feature/Middleware/SubstituteBindingsTest.php index 4c0a542a..dd2d7e4f 100644 --- a/tests/Feature/Middleware/SubstituteBindingsTest.php +++ b/tests/Feature/Middleware/SubstituteBindingsTest.php @@ -15,9 +15,9 @@ use LaravelDoctrine\ORM\Middleware\SubstituteBindings; use LaravelDoctrineTest\ORM\Assets\Middleware\BindableEntity; use LaravelDoctrineTest\ORM\Assets\Middleware\BindableEntityWithInterface; +use LaravelDoctrineTest\ORM\TestCase; use Mockery as m; use Mockery\Mock; -use PHPUnit\Framework\TestCase; class SubstituteBindingsTest extends TestCase { @@ -41,6 +41,8 @@ public function setUp(): void $this->registry = m::mock(ManagerRegistry::class); $this->em = m::mock(EntityManager::class); $this->repository = m::mock(ObjectRepository::class); + + parent::setUp(); } protected function getRouter() @@ -194,5 +196,7 @@ public function test_for_typed_value_binding() protected function tearDown(): void { m::close(); + + parent::tearDown(); } } diff --git a/tests/Feature/Notifications/DoctrineChannelTest.php b/tests/Feature/Notifications/DoctrineChannelTest.php index 514afd01..29d8fadc 100644 --- a/tests/Feature/Notifications/DoctrineChannelTest.php +++ b/tests/Feature/Notifications/DoctrineChannelTest.php @@ -11,9 +11,9 @@ use LaravelDoctrineTest\ORM\Assets\Notifications\NotificationDatabaseStub; use LaravelDoctrineTest\ORM\Assets\Notifications\NotificationInvalidStub; use LaravelDoctrineTest\ORM\Assets\Notifications\NotificationStub; +use LaravelDoctrineTest\ORM\TestCase; use Mockery; use Mockery\Mock; -use PHPUnit\Framework\TestCase; use RuntimeException; class DoctrineChannelTest extends TestCase @@ -40,6 +40,8 @@ public function setUp(): void $this->channel = new DoctrineChannel( $this->registry = Mockery::mock(ManagerRegistry::class) ); + + parent::setUp(); } public function test_can_send_notification_on_default_em() diff --git a/tests/Feature/Notifications/NotificationTest.php b/tests/Feature/Notifications/NotificationTest.php index 79faca83..73c37bea 100644 --- a/tests/Feature/Notifications/NotificationTest.php +++ b/tests/Feature/Notifications/NotificationTest.php @@ -4,9 +4,9 @@ use Doctrine\ORM\EntityManagerInterface; use LaravelDoctrine\ORM\Notifications\Notification; +use LaravelDoctrineTest\ORM\TestCase; use Mockery; use Mockery\Mock; -use PHPUnit\Framework\TestCase; use ReflectionClass; use stdClass; @@ -25,6 +25,8 @@ class NotificationTest extends TestCase public function setUp(): void { $this->em = Mockery::spy(EntityManagerInterface::class); + + parent::setUp(); } public function testClassFunctions() diff --git a/tests/Feature/Pagination/PaginatorAdapterTest.php b/tests/Feature/Pagination/PaginatorAdapterTest.php index 112f728b..178faa74 100644 --- a/tests/Feature/Pagination/PaginatorAdapterTest.php +++ b/tests/Feature/Pagination/PaginatorAdapterTest.php @@ -14,8 +14,8 @@ use Illuminate\Contracts\Pagination\LengthAwarePaginator; use Illuminate\Pagination\AbstractPaginator; use LaravelDoctrine\ORM\Pagination\PaginatorAdapter; +use LaravelDoctrineTest\ORM\TestCase; use Mockery; -use PHPUnit\Framework\TestCase; use stdClass; class PaginatorAdapterTest extends TestCase diff --git a/tests/Feature/Resolvers/EntityListenerResolverTest.php b/tests/Feature/Resolvers/EntityListenerResolverTest.php index 40f183db..98501d96 100644 --- a/tests/Feature/Resolvers/EntityListenerResolverTest.php +++ b/tests/Feature/Resolvers/EntityListenerResolverTest.php @@ -5,8 +5,8 @@ use Doctrine\ORM\Mapping\EntityListenerResolver as ResolverContract; use Illuminate\Contracts\Container\Container; use LaravelDoctrine\ORM\Resolvers\EntityListenerResolver; +use LaravelDoctrineTest\ORM\TestCase; use Mockery as m; -use PHPUnit\Framework\TestCase; use stdClass; use TypeError; @@ -26,11 +26,15 @@ protected function setUp(): void { $this->container = m::mock(Container::class); $this->resolver = new EntityListenerResolver($this->container); + + parent::setUp(); } protected function tearDown(): void { m::close(); + + parent::tearDown(); } public function testImplementsDoctrineInterface() diff --git a/tests/Feature/Serializers/ArraySerializerTest.php b/tests/Feature/Serializers/ArraySerializerTest.php index 9c5e6537..2ea03491 100644 --- a/tests/Feature/Serializers/ArraySerializerTest.php +++ b/tests/Feature/Serializers/ArraySerializerTest.php @@ -2,9 +2,9 @@ namespace LaravelDoctrineTest\ORM\Feature\Serializers; -use LaravelDoctrine\ORM\Serializers\Arrayable; use LaravelDoctrine\ORM\Serializers\ArraySerializer; -use PHPUnit\Framework\TestCase; +use LaravelDoctrineTest\ORM\Assets\Serializers\ArrayableEntity; +use LaravelDoctrineTest\ORM\TestCase; class ArraySerializerTest extends TestCase { @@ -16,6 +16,8 @@ class ArraySerializerTest extends TestCase protected function setUp(): void { $this->serializer = new ArraySerializer; + + parent::setUp(); } public function test_can_serialize_to_array() @@ -33,29 +35,3 @@ public function test_can_serialize_to_array() ], $array); } } - -class ArrayableEntity -{ - use Arrayable; - - protected $id = 'IDVALUE'; - - protected $name = 'NAMEVALUE'; - - protected $list = ['item1', 'item2']; - - public function getId() - { - return $this->id; - } - - public function getName() - { - return $this->name; - } - - public function getList() - { - return $this->list; - } -} diff --git a/tests/Feature/Serializers/JsonSerializerTest.php b/tests/Feature/Serializers/JsonSerializerTest.php index fa11f92d..7970758f 100644 --- a/tests/Feature/Serializers/JsonSerializerTest.php +++ b/tests/Feature/Serializers/JsonSerializerTest.php @@ -2,9 +2,9 @@ namespace LaravelDoctrineTest\ORM\Feature\Serializers; -use LaravelDoctrine\ORM\Serializers\Jsonable; use LaravelDoctrine\ORM\Serializers\JsonSerializer; -use PHPUnit\Framework\TestCase; +use LaravelDoctrineTest\ORM\Assets\Serializers\JsonableEntity; +use LaravelDoctrineTest\ORM\TestCase; class JsonSerializerTest extends TestCase { @@ -16,6 +16,8 @@ class JsonSerializerTest extends TestCase protected function setUp(): void { $this->serializer = new JsonSerializer; + + parent::setUp(); } public function test_can_serialize_to_json() @@ -39,29 +41,3 @@ public function test_can_serialize_to_json_with_numeric_check() $this->assertEquals('{"id":"IDVALUE","name":"NAMEVALUE","numeric":1}', $json); } } - -class JsonableEntity -{ - use Jsonable; - - protected $id = 'IDVALUE'; - - protected $name = 'NAMEVALUE'; - - protected $numeric = "1"; - - public function getId() - { - return $this->id; - } - - public function getName() - { - return $this->name; - } - - public function getNumeric() - { - return $this->numeric; - } -} diff --git a/tests/Feature/Testing/Concerns/InteractsWithEntitiesTest.php b/tests/Feature/Testing/Concerns/InteractsWithEntitiesTest.php index e1c0c6fd..b6ef8199 100644 --- a/tests/Feature/Testing/Concerns/InteractsWithEntitiesTest.php +++ b/tests/Feature/Testing/Concerns/InteractsWithEntitiesTest.php @@ -6,8 +6,8 @@ use Doctrine\ORM\EntityRepository; use Illuminate\Contracts\Container\Container; use LaravelDoctrine\ORM\Testing\Concerns\InteractsWithEntities; +use LaravelDoctrineTest\ORM\MockeryTestCase; use Mockery; -use Mockery\Adapter\Phpunit\MockeryTestCase; use PHPUnit\Framework\ExpectationFailedException; class InteractsWithEntitiesTest extends MockeryTestCase @@ -26,6 +26,8 @@ public function setUp(): void ->allows('make') ->with('em') ->andReturn($this->em); + + parent::setUp(); } public function testEntitiesMatchWithMatch() diff --git a/tests/Feature/Testing/FactoryBuilderTest.php b/tests/Feature/Testing/FactoryBuilderTest.php index 77b0c5d3..6f24cf52 100644 --- a/tests/Feature/Testing/FactoryBuilderTest.php +++ b/tests/Feature/Testing/FactoryBuilderTest.php @@ -10,7 +10,7 @@ use Doctrine\Persistence\ManagerRegistry; use Faker; use LaravelDoctrine\ORM\Testing\FactoryBuilder; -use Mockery\Adapter\Phpunit\MockeryTestCase; +use LaravelDoctrineTest\ORM\MockeryTestCase; class FactoryBuilderTest extends MockeryTestCase { @@ -74,6 +74,8 @@ protected function setUp(): void $this->entityManager->shouldReceive('persist'); $this->entityManager->shouldReceive('flush'); + + parent::setUp(); } protected function getFactoryBuilder(array $definitions = [], array $states = [], array $afterMaking = [], array $afterCreating = []): FactoryBuilder diff --git a/tests/Feature/Testing/FactoryTest.php b/tests/Feature/Testing/FactoryTest.php index a3241fc4..86db8b22 100644 --- a/tests/Feature/Testing/FactoryTest.php +++ b/tests/Feature/Testing/FactoryTest.php @@ -5,8 +5,8 @@ use Doctrine\Persistence\ManagerRegistry; use Faker; use LaravelDoctrine\ORM\Testing\Factory; +use LaravelDoctrineTest\ORM\MockeryTestCase; use Mockery; -use Mockery\Adapter\Phpunit\MockeryTestCase; class FactoryTest extends MockeryTestCase { diff --git a/tests/Feature/Testing/SimpleHydratorTest.php b/tests/Feature/Testing/SimpleHydratorTest.php index fb90d1eb..875dad27 100644 --- a/tests/Feature/Testing/SimpleHydratorTest.php +++ b/tests/Feature/Testing/SimpleHydratorTest.php @@ -5,7 +5,7 @@ use LaravelDoctrine\ORM\Testing\SimpleHydrator; use LaravelDoctrineTest\ORM\Assets\Testing\AncestorHydrateableClass; use LaravelDoctrineTest\ORM\Assets\Testing\ChildHydrateableClass; -use PHPUnit\Framework\TestCase; +use LaravelDoctrineTest\ORM\TestCase; class SimpleHydratorTest extends TestCase { diff --git a/tests/Feature/Validation/DoctrinePresenceVerifierTest.php b/tests/Feature/Validation/DoctrinePresenceVerifierTest.php index 36130394..43093aca 100644 --- a/tests/Feature/Validation/DoctrinePresenceVerifierTest.php +++ b/tests/Feature/Validation/DoctrinePresenceVerifierTest.php @@ -10,9 +10,9 @@ use InvalidArgumentException; use LaravelDoctrine\ORM\Validation\DoctrinePresenceVerifier; use LaravelDoctrineTest\ORM\Assets\Mock\CountableEntityMock; +use LaravelDoctrineTest\ORM\TestCase; use Mockery as m; use Mockery\Mock; -use PHPUnit\Framework\TestCase; class DoctrinePresenceVerifierTest extends TestCase { @@ -53,6 +53,8 @@ protected function setUp(): void $this->verifier = new DoctrinePresenceVerifier( $this->registry ); + + parent::setUp(); } public function test_can_get_count() @@ -271,5 +273,7 @@ protected function defaultGetMultiCountMocks() protected function tearDown(): void { m::close(); + + parent::tearDown(); } } diff --git a/tests/MockeryTestCase.php b/tests/MockeryTestCase.php new file mode 100644 index 00000000..428d1d1f --- /dev/null +++ b/tests/MockeryTestCase.php @@ -0,0 +1,20 @@ +