diff --git a/appdata/modules/FramelixTests/tests/Db/BasicTestBase.php b/appdata/modules/FramelixTests/tests/Db/BasicTestBase.php index 1a7f642..deb08b7 100644 --- a/appdata/modules/FramelixTests/tests/Db/BasicTestBase.php +++ b/appdata/modules/FramelixTests/tests/Db/BasicTestBase.php @@ -6,6 +6,7 @@ use Framelix\Framelix\DateTime; use Framelix\Framelix\Db\Sql; use Framelix\FramelixTests\TestCaseDbTypes; +use PHPUnit\Framework\Attributes\Depends; use ReflectionClass; use function fopen; @@ -25,9 +26,7 @@ public function testCreate(): void $this->createTestTable(); } - /** - * @depends testCreate - */ + #[Depends("testCreate")] public function testConditions() { $db = $this->getDb(); @@ -152,9 +151,7 @@ public function testConditions() $db->query("DROP TABLE $table"); } - /** - * @depends testConditions - */ + #[Depends("testConditions")] public function testQueries(): void { Sql::$logExecutedQueries = true; @@ -228,9 +225,7 @@ public function testQueries(): void $this->assertCount(2, $db->fetchArray("SELECT text_a FROM $table", null, 2)); } - /** - * @depends testQueries - */ + #[Depends("testQueries")] public function testExceptionDbQuery() { $db = $this->getDb(); @@ -244,9 +239,7 @@ public function testExceptionDbQuery() }); } - /** - * @depends testExceptionDbQuery - */ + #[Depends("testExceptionDbQuery")] public function testExceptionNotExistingFetchIndex() { $this->assertExceptionOnCall(function () { @@ -255,9 +248,7 @@ public function testExceptionNotExistingFetchIndex() }); } - /** - * @depends testExceptionNotExistingFetchIndex - */ + #[Depends("testExceptionNotExistingFetchIndex")] public function testExceptionUnsupportedDbValue() { $this->assertExceptionOnCall(function () { @@ -267,10 +258,7 @@ public function testExceptionUnsupportedDbValue() }); } - /** - * Drop tables after execution - * @depends testExceptionUnsupportedDbValue - */ + #[Depends("testExceptionUnsupportedDbValue")] public function testCleanup(): void { $this->expectNotToPerformAssertions(); diff --git a/appdata/modules/FramelixTests/tests/Db/BasicTestMysqlTest.php b/appdata/modules/FramelixTests/tests/Db/BasicTestMysqlTest.php index 3b58c83..f0901fa 100644 --- a/appdata/modules/FramelixTests/tests/Db/BasicTestMysqlTest.php +++ b/appdata/modules/FramelixTests/tests/Db/BasicTestMysqlTest.php @@ -3,6 +3,7 @@ namespace Db; use Framelix\Framelix\Db\Mysql; +use PHPUnit\Framework\Attributes\Depends; final class BasicTestMysqlTest extends BasicTestBase { @@ -30,9 +31,7 @@ protected function createTestTable(): void ); } - /** - * @depends testCleanup - */ + #[Depends("testCleanup")] public function testExceptionConnectError() { $this->assertExceptionOnCall(function () { diff --git a/appdata/modules/FramelixTests/tests/Db/BasicTestPostgresTest.php b/appdata/modules/FramelixTests/tests/Db/BasicTestPostgresTest.php index 1164695..d89b10b 100644 --- a/appdata/modules/FramelixTests/tests/Db/BasicTestPostgresTest.php +++ b/appdata/modules/FramelixTests/tests/Db/BasicTestPostgresTest.php @@ -3,6 +3,7 @@ namespace Db; use Framelix\Framelix\Db\Postgres; +use PHPUnit\Framework\Attributes\Depends; final class BasicTestPostgresTest extends BasicTestBase { @@ -27,9 +28,7 @@ protected function createTestTable(): void ); } - /** - * @depends testCleanup - */ + #[Depends("testCleanup")] public function testExceptionConnectError() { $this->assertExceptionOnCall(function () { diff --git a/appdata/modules/FramelixTests/tests/Db/BasicTestSqliteTest.php b/appdata/modules/FramelixTests/tests/Db/BasicTestSqliteTest.php index c0412fe..aeb9c19 100644 --- a/appdata/modules/FramelixTests/tests/Db/BasicTestSqliteTest.php +++ b/appdata/modules/FramelixTests/tests/Db/BasicTestSqliteTest.php @@ -3,6 +3,7 @@ namespace Db; use Framelix\Framelix\Db\Sqlite; +use PHPUnit\Framework\Attributes\Depends; final class BasicTestSqliteTest extends BasicTestBase { @@ -27,9 +28,7 @@ protected function createTestTable(): void ); } - /** - * @depends testCreate - */ + #[Depends("testCreate")] public function testExceptionConnectError() { $this->assertExceptionOnCall(function () { diff --git a/appdata/modules/FramelixTests/tests/Db/StorableSchemeBuilderTestBase.php b/appdata/modules/FramelixTests/tests/Db/StorableSchemeBuilderTestBase.php index 01bd860..5a5c2d2 100644 --- a/appdata/modules/FramelixTests/tests/Db/StorableSchemeBuilderTestBase.php +++ b/appdata/modules/FramelixTests/tests/Db/StorableSchemeBuilderTestBase.php @@ -11,6 +11,8 @@ use Framelix\FramelixTests\StorableException\TestStorableUnsupportedType; use Framelix\FramelixTests\TestCaseDbTypes; +use PHPUnit\Framework\Attributes\Depends; + use function count; use function in_array; use function print_r; @@ -43,9 +45,7 @@ public function testBuilderQueries(): void $this->assertBuilderQueryCount(0, $queries, true); } - /** - * @depends testBuilderQueries - */ + #[Depends("testBuilderQueries")] public function testBuilderQueries2(): void { $db = Sql::get('test'); @@ -67,9 +67,7 @@ public function testBuilderQueries2(): void $this->assertBuilderQueryCount(4, $queries, true); } - /** - * @depends testBuilderQueries2 - */ + #[Depends("testBuilderQueries2")] public function testBuilderQueries3(): void { // previously we have changed 3 columns and dropped one index @@ -97,9 +95,7 @@ public function testBuilderQueries3(): void $db->query('CREATE TABLE ' . $db->quoteIdentifier('unused_table') . ' (`id` INTEGER NULL DEFAULT NULL)'); } - /** - * @depends testBuilderQueries3 - */ + #[Depends("testBuilderQueries3")] public function testBuilderQueries4(): void { $db = Sql::get('test'); @@ -122,9 +118,7 @@ public function testBuilderQueries4(): void } - /** - * @depends testBuilderQueries3 - */ + #[Depends("testBuilderQueries3")] public function testUnsupportedDbPropertyType(): void { $this->assertExceptionOnCall(function () { @@ -139,9 +133,7 @@ public function testUnsupportedDbPropertyType(): void } - /** - * @depends testUnsupportedDbPropertyType - */ + #[Depends("testUnsupportedDbPropertyType")] public function testNoDbPropertyType(): void { $this->assertExceptionOnCall(function () { diff --git a/appdata/modules/FramelixTests/tests/Db/StorableTestBase.php b/appdata/modules/FramelixTests/tests/Db/StorableTestBase.php index c7e8c23..6a887db 100644 --- a/appdata/modules/FramelixTests/tests/Db/StorableTestBase.php +++ b/appdata/modules/FramelixTests/tests/Db/StorableTestBase.php @@ -23,6 +23,8 @@ use Framelix\FramelixTests\Storable\TestStorablePrefetch; use Framelix\FramelixTests\TestCaseDbTypes; +use PHPUnit\Framework\Attributes\Depends; + use function array_chunk; use function array_keys; use function array_reverse; @@ -216,9 +218,7 @@ public function testStoreAndDelete(): void } } - /** - * @depends testStoreAndDelete - */ + #[Depends("testStoreAndDelete")] public function testFetch(): void { // fetch last 50 teststorables1 as they all have the same data applied @@ -288,9 +288,7 @@ public function testFetch(): void $storable->delete(true); } - /** - * @depends testFetch - */ + #[Depends("testFetch")] public function testDepthFetch(): void { $storables = TestStorable2::getByCondition( @@ -299,9 +297,7 @@ public function testDepthFetch(): void $this->assertGreaterThan(0, count($storables)); } - /** - * @depends testDepthFetch - */ + #[Depends("testDepthFetch")] public function testUpdate(): void { // updateTime does update by default @@ -322,9 +318,7 @@ public function testUpdate(): void $this->assertEquals($upateTime, $storable->updateTime->getTimestamp()); } - /** - * @depends testDepthFetch - */ + #[Depends("testDepthFetch")] public function testFetchChildsOfAbstractStorables(): void { // fetching all from type storable are effectively all that exist @@ -344,9 +338,7 @@ public function testFetchChildsOfAbstractStorables(): void $this->assertSame($chunk, array_keys($storables)); } - /** - * @depends testFetchChildsOfAbstractStorables - */ + #[Depends("testFetchChildsOfAbstractStorables")] public function testDatatypesSetter(): void { $this->dummyValues = [ @@ -371,9 +363,7 @@ public function testDatatypesSetter(): void $this->assertStorablePropertyValueSetter($storable, "dateTime", [DateTime::class]); } - /** - * @depends testDatatypesSetter - */ + #[Depends("testDatatypesSetter")] public function testDatatypesGetter(): void { $storable = TestStorable2::getByConditionOne( @@ -394,9 +384,7 @@ public function testDatatypesGetter(): void $this->assertIsString($storable->getOriginalDbValueForProperty("longTextLazy")); } - /** - * @depends testDatatypesSetter - */ + #[Depends("testDatatypesSetter")] public function testDatatypesNoPrefetch(): void { $storables = TestStorablePrefetch::getByCondition(); @@ -410,9 +398,7 @@ public function testDatatypesNoPrefetch(): void $this->assertExecutedQueries(count($storables)); } - /** - * @depends testDatatypesNoPrefetch - */ + #[Depends("testDatatypesNoPrefetch")] public function testDatatypesPrefetch(): void { $storables = TestStorablePrefetch::getByCondition(); @@ -431,9 +417,7 @@ public function testDatatypesPrefetch(): void $this->assertExecutedQueries($requiredPrefetchQueries); } - /** - * @depends testDatatypesPrefetch - */ + #[Depends("testDatatypesPrefetch")] public function testDeleteAll(): void { // delete with null does nothing @@ -443,9 +427,7 @@ public function testDeleteAll(): void $this->assertCount(0, TestStorable1::getByCondition()); } - /** - * @depends testDeleteAll - */ + #[Depends("testDeleteAll")] public function testMiscExceptions(): void { $this->assertExceptionOnCall(function () { @@ -487,10 +469,7 @@ public function testMiscExceptions(): void }, [], Redirect::class); } - /** - * Test all framework default storables with generic and specific tests - * @depends testMiscExceptions - */ + #[Depends("testMiscExceptions")] public function testDefaultStorables(): void { $storableFiles = FileUtils::getFiles( diff --git a/appdata/modules/FramelixTests/tests/Html/CompilerTest.php b/appdata/modules/FramelixTests/tests/Html/CompilerTest.php index e20e999..4312ea8 100644 --- a/appdata/modules/FramelixTests/tests/Html/CompilerTest.php +++ b/appdata/modules/FramelixTests/tests/Html/CompilerTest.php @@ -8,6 +8,8 @@ use Framelix\Framelix\Utils\FileUtils; use Framelix\FramelixTests\TestCase; +use PHPUnit\Framework\Attributes\Depends; + use function file_get_contents; use function file_put_contents; use function unlink; @@ -28,9 +30,7 @@ public function testCleanup(): void $this->assertCount(0, $files); } - /** - * @depends testCleanup - */ + #[Depends("testCleanup")] public function testBabel(): void { Config::$devMode = false; @@ -40,9 +40,7 @@ public function testBabel(): void Config::$devMode = true; } - /** - * @depends testBabel - */ + #[Depends("testBabel")] public function tests(): void { $distFolder = __DIR__ . "/../../public/dist"; @@ -72,9 +70,7 @@ public function tests(): void ); } - /** - * @depends tests - */ + #[Depends("tests")] public function testUrls(): void { $this->assertInstanceOf( diff --git a/appdata/modules/FramelixTests/tests/Utils/FileUtilsTest.php b/appdata/modules/FramelixTests/tests/Utils/FileUtilsTest.php index 2e3ad5c..047ccde 100644 --- a/appdata/modules/FramelixTests/tests/Utils/FileUtilsTest.php +++ b/appdata/modules/FramelixTests/tests/Utils/FileUtilsTest.php @@ -5,6 +5,8 @@ use Framelix\Framelix\Utils\FileUtils; use Framelix\FramelixTests\TestCase; +use PHPUnit\Framework\Attributes\Depends; + use function basename; use function dirname; use function file_put_contents; @@ -104,9 +106,7 @@ public function testTmpFolder1(): void $this->assertCount(1, FileUtils::getFiles($folder)); } - /** - * @depends testTmpFolder1 - */ + #[Depends("testTmpFolder1")] public function testTmpFolder2(): void { $this->assertCount(