diff --git a/tests/Migration/E2E/Sources/NHostTest.php b/tests/Migration/E2E/Sources/NHostTest.php index a2d59e05..ca4d9f3a 100644 --- a/tests/Migration/E2E/Sources/NHostTest.php +++ b/tests/Migration/E2E/Sources/NHostTest.php @@ -183,10 +183,10 @@ public function testValidateUserTransfer($state): void $this->fail('User "test@test.com" not found'); } - $this->assertEquals('success', $foundUser->getStatus()); - $this->assertEquals('$2a$10$ARQ/f.K6OmCjZ8XF0U.6fezPMlxDqsmcl0Rs6xQVkvj62u7gcSzOW', $foundUser->getPasswordHash()->getHash()); - $this->assertEquals('bcrypt', $foundUser->getPasswordHash()->getAlgorithm()); - $this->assertEquals('test@test.com', $foundUser->getUsername()); + $this->assertSame('success', $foundUser->getStatus()); + $this->assertSame('$2a$10$ARQ/f.K6OmCjZ8XF0U.6fezPMlxDqsmcl0Rs6xQVkvj62u7gcSzOW', $foundUser->getPasswordHash()->getHash()); + $this->assertSame('bcrypt', $foundUser->getPasswordHash()->getAlgorithm()); + $this->assertSame('test@test.com', $foundUser->getUsername()); } #[Depends('testValidateDestinationErrors')] @@ -209,9 +209,9 @@ public function testValidateDatabaseTransfer($state) $this->fail('Database "public" not found'); } - $this->assertEquals('success', $foundDatabase->getStatus()); - $this->assertEquals('public', $foundDatabase->getDatabaseName()); - $this->assertEquals('public', $foundDatabase->getId()); + $this->assertSame('success', $foundDatabase->getStatus()); + $this->assertSame('public', $foundDatabase->getDatabaseName()); + $this->assertSame('public', $foundDatabase->getId()); // Find known table $tables = $state['source']->cache->get(Resource::TYPE_TABLE); @@ -230,10 +230,10 @@ public function testValidateDatabaseTransfer($state) $this->fail('Table "TestTable" not found'); } - $this->assertEquals('success', $foundTable->getStatus()); - $this->assertEquals('TestTable', $foundTable->getTableName()); - $this->assertEquals('TestTable', $foundTable->getId()); - $this->assertEquals('public', $foundTable->getDatabase()->getId()); + $this->assertSame('success', $foundTable->getStatus()); + $this->assertSame('TestTable', $foundTable->getTableName()); + $this->assertSame('TestTable', $foundTable->getId()); + $this->assertSame('public', $foundTable->getDatabase()->getId()); return $state; } @@ -258,10 +258,10 @@ public function testDatabaseFunctionalDefaultsWarn($state): void $this->fail('Table "FunctionalDefaultTestTable" not found'); } - $this->assertEquals('warning', $foundTable->getStatus()); - $this->assertEquals('FunctionalDefaultTestTable', $foundTable->getTableName()); - $this->assertEquals('FunctionalDefaultTestTable', $foundTable->getId()); - $this->assertEquals('public', $foundTable->getDatabase()->getId()); + $this->assertSame('warning', $foundTable->getStatus()); + $this->assertSame('FunctionalDefaultTestTable', $foundTable->getTableName()); + $this->assertSame('FunctionalDefaultTestTable', $foundTable->getId()); + $this->assertSame('public', $foundTable->getDatabase()->getId()); } #[Depends('testValidateDatabaseTransfer')] @@ -284,8 +284,8 @@ public function testValidateStorageTransfer($state): void $this->fail('Bucket "default" not found'); } - $this->assertEquals('success', $foundBucket->getStatus()); - $this->assertEquals('default', $foundBucket->getId()); + $this->assertSame('success', $foundBucket->getStatus()); + $this->assertSame('default', $foundBucket->getId()); // Find known file $files = $state['source']->cache->get(Resource::TYPE_FILE); @@ -304,11 +304,11 @@ public function testValidateStorageTransfer($state): void $this->fail('File "tulips.png" not found'); } /** @var File $foundFile */ - $this->assertEquals('success', $foundFile->getStatus()); - $this->assertEquals('tulips.png', $foundFile->getFileName()); - $this->assertEquals('default', $foundFile->getBucket()->getId()); - $this->assertEquals('image/png', $foundFile->getMimeType()); - $this->assertEquals(679233, $foundFile->getSize()); - $this->assertEquals('', $foundFile->getData()); // Memory Leak Check + $this->assertSame('success', $foundFile->getStatus()); + $this->assertSame('tulips.png', $foundFile->getFileName()); + $this->assertSame('default', $foundFile->getBucket()->getId()); + $this->assertSame('image/png', $foundFile->getMimeType()); + $this->assertSame(679233, $foundFile->getSize()); + $this->assertSame('', $foundFile->getData()); // Memory Leak Check } } diff --git a/tests/Migration/E2E/Sources/SupabaseTest.php b/tests/Migration/E2E/Sources/SupabaseTest.php index a4745799..2ce03972 100644 --- a/tests/Migration/E2E/Sources/SupabaseTest.php +++ b/tests/Migration/E2E/Sources/SupabaseTest.php @@ -164,9 +164,9 @@ public function testValidateUserTransfer($state): void $this->fail('User "albert.kihn95@yahoo.com" not found'); } - $this->assertEquals('success', $foundUser->getStatus()); - $this->assertEquals('$2a$10$NGZAAOfXeheUoH9V3dnRoeR.r3J5ynnSZ6KjvHxOUlV8XUrulJzQa', $foundUser->getPasswordHash()->getHash()); - $this->assertEquals('bcrypt', $foundUser->getPasswordHash()->getAlgorithm()); + $this->assertSame('success', $foundUser->getStatus()); + $this->assertSame('$2a$10$NGZAAOfXeheUoH9V3dnRoeR.r3J5ynnSZ6KjvHxOUlV8XUrulJzQa', $foundUser->getPasswordHash()->getHash()); + $this->assertSame('bcrypt', $foundUser->getPasswordHash()->getAlgorithm()); } #[Depends('testValidateDestinationErrors')] @@ -190,9 +190,9 @@ public function testValidateDatabaseTransfer($state) $this->fail('Database "public" not found'); } - $this->assertEquals('success', $foundDatabase->getStatus()); - $this->assertEquals('public', $foundDatabase->getDatabaseName()); - $this->assertEquals('public', $foundDatabase->getId()); + $this->assertSame('success', $foundDatabase->getStatus()); + $this->assertSame('public', $foundDatabase->getDatabaseName()); + $this->assertSame('public', $foundDatabase->getId()); // Find Known Tables $tables = $state['source']->cache->get(Resource::TYPE_TABLE); @@ -213,10 +213,10 @@ public function testValidateDatabaseTransfer($state) $this->fail('Table "test" not found'); } - $this->assertEquals('success', $foundTable->getStatus()); - $this->assertEquals('test', $foundTable->getTableName()); - $this->assertEquals('public', $foundTable->getDatabase()->getDatabaseName()); - $this->assertEquals('public', $foundTable->getDatabase()->getId()); + $this->assertSame('success', $foundTable->getStatus()); + $this->assertSame('test', $foundTable->getTableName()); + $this->assertSame('public', $foundTable->getDatabase()->getDatabaseName()); + $this->assertSame('public', $foundTable->getDatabase()->getId()); // Find Known Documents $documents = $state['source']->cache->get(Resource::TYPE_ROW); @@ -237,7 +237,7 @@ public function testValidateDatabaseTransfer($state) // $this->fail('Document "1" not found'); // } // - // $this->assertEquals('success', $foundDocument->getStatus()); + // $this->assertSame('success', $foundDocument->getStatus()); return $state; } @@ -262,10 +262,10 @@ public function testDatabaseFunctionalDefaultsWarn($state): void $this->fail('Table "FunctionalDefaultTestTable" not found'); } - $this->assertEquals('warning', $foundTable->getStatus()); - $this->assertEquals('FunctionalDefaultTestTable', $foundTable->getTableName()); - $this->assertEquals('FunctionalDefaultTestTable', $foundTable->getId()); - $this->assertEquals('public', $foundTable->getDatabase()->getId()); + $this->assertSame('warning', $foundTable->getStatus()); + $this->assertSame('FunctionalDefaultTestTable', $foundTable->getTableName()); + $this->assertSame('FunctionalDefaultTestTable', $foundTable->getId()); + $this->assertSame('public', $foundTable->getDatabase()->getId()); } #[Depends('testValidateDestinationErrors')] @@ -290,7 +290,7 @@ public function testValidateStorageTransfer($state): void $this->fail('Bucket "Test Bucket 1" not found'); } - $this->assertEquals('success', $foundBucket->getStatus()); + $this->assertSame('success', $foundBucket->getStatus()); // Find known file $files = $state['source']->cache->get(Resource::TYPE_FILE); @@ -311,10 +311,10 @@ public function testValidateStorageTransfer($state): void $this->fail('File "tulips.png" not found'); } /** @var File $foundFile */ - $this->assertEquals('success', $foundFile->getStatus()); - $this->assertEquals('tulips.png', $foundFile->getFileName()); - $this->assertEquals('image/png', $foundFile->getMimeType()); - $this->assertEquals(679233, $foundFile->getSize()); - $this->assertEquals('', $foundFile->getData()); // Memory Leak Check + $this->assertSame('success', $foundFile->getStatus()); + $this->assertSame('tulips.png', $foundFile->getFileName()); + $this->assertSame('image/png', $foundFile->getMimeType()); + $this->assertSame(679233, $foundFile->getSize()); + $this->assertSame('', $foundFile->getData()); // Memory Leak Check } } diff --git a/tests/Migration/Unit/General/CSVTest.php b/tests/Migration/Unit/General/CSVTest.php index 62304207..69719917 100644 --- a/tests/Migration/Unit/General/CSVTest.php +++ b/tests/Migration/Unit/General/CSVTest.php @@ -70,7 +70,7 @@ public function testDetectDelimiter() $delimiter = $this->detectDelimiter($stream); fclose($stream); - $this->assertEquals($case['expected'], $delimiter, "Failed for {$case['file']}"); + $this->assertSame($case['expected'], $delimiter, "Failed for {$case['file']}"); } } @@ -105,7 +105,7 @@ public function testCSVExportBasic() $csvDestination->testableImport([$row1, $row2], function ($resources) { // Callback - verify resources are marked as successful foreach ($resources as $resource) { - $this->assertEquals('success', $resource->getStatus()); + $this->assertSame('success', $resource->getStatus()); } }); @@ -138,12 +138,12 @@ public function testCSVExportBasic() $this->assertContains('email', $header); // Check first row data - $this->assertEquals('row1', $row1Data[0]); // $id + $this->assertSame('row1', $row1Data[0]); // $id $this->assertStringContainsString('user:123', $row1Data[1]); // $permissions // $createdAt and $updatedAt are empty for test data - $this->assertEquals('John Doe', $row1Data[4]); // name - $this->assertEquals('30', $row1Data[5]); // age - $this->assertEquals('john@example.com', $row1Data[6]); // email + $this->assertSame('John Doe', $row1Data[4]); // name + $this->assertSame('30', $row1Data[5]); // age + $this->assertSame('john@example.com', $row1Data[6]); // email // Cleanup if (is_dir($tempDir)) { @@ -187,10 +187,10 @@ public function testCSVExportWithSpecialCharacters() // Verify special characters are properly handled // Indices are shifted by 2 due to $createdAt and $updatedAt - $this->assertEquals('Text with "quotes"', $rowData[4]); // quote_field - $this->assertEquals('Text, with, commas', $rowData[5]); // comma_field - $this->assertEquals("Text with\nnewlines", $rowData[6]); // newline_field - $this->assertEquals('Text with "quotes", commas, and\nnewlines', $rowData[7]); // mixed_field + $this->assertSame('Text with "quotes"', $rowData[4]); // quote_field + $this->assertSame('Text, with, commas', $rowData[5]); // comma_field + $this->assertSame("Text with\nnewlines", $rowData[6]); // newline_field + $this->assertSame('Text with "quotes", commas, and\nnewlines', $rowData[7]); // mixed_field // Cleanup if (is_dir($tempDir)) { @@ -233,9 +233,9 @@ public function testCSVExportWithArrays() // Arrays should be JSON encoded // Indices are shifted by 2 due to $createdAt and $updatedAt - $this->assertEquals('["php","csv","export"]', $rowData[4]); // tags + $this->assertSame('["php","csv","export"]', $rowData[4]); // tags $this->assertJson($rowData[5]); // metadata should be valid JSON - $this->assertEquals('', $rowData[6]); // empty_array + $this->assertSame('', $rowData[6]); // empty_array $this->assertJson($rowData[7]); // nested should be valid JSON // Cleanup @@ -279,11 +279,11 @@ public function testCSVExportWithNullValues() $this->assertNotFalse($rowData); // Indices are shifted by 2 due to $createdAt and $updatedAt - $this->assertEquals('Test', $rowData[4]); // name - $this->assertEquals('null', $rowData[5]); // null_field -> "null" string - $this->assertEquals('', $rowData[6]); // empty_string - $this->assertEquals('0', $rowData[7]); // zero - $this->assertEquals('false', $rowData[8]); // false_bool + $this->assertSame('Test', $rowData[4]); // name + $this->assertSame('null', $rowData[5]); // null_field -> "null" string + $this->assertSame('', $rowData[6]); // empty_string + $this->assertSame('0', $rowData[7]); // zero + $this->assertSame('false', $rowData[8]); // false_bool // Cleanup if (is_dir($tempDir)) { @@ -385,12 +385,12 @@ public function testCSVExportImportCompatibility() // Verify we can reconstruct the data $reconstructed = \array_combine($header, $data); - $this->assertEquals('compat_row', $reconstructed['$id']); - $this->assertEquals('John Doe', $reconstructed['name']); - $this->assertEquals('30', $reconstructed['age']); - $this->assertEquals('null', $reconstructed['null_field']); // null becomes "null" string - $this->assertEquals('', $reconstructed['empty_field']); - $this->assertEquals('true', $reconstructed['bool_field']); // bool becomes string + $this->assertSame('compat_row', $reconstructed['$id']); + $this->assertSame('John Doe', $reconstructed['name']); + $this->assertSame('30', $reconstructed['age']); + $this->assertSame('null', $reconstructed['null_field']); // null becomes "null" string + $this->assertSame('', $reconstructed['empty_field']); + $this->assertSame('true', $reconstructed['bool_field']); // bool becomes string // Check that createdAt and updatedAt are in the reconstructed data $this->assertArrayHasKey('$createdAt', $reconstructed); $this->assertArrayHasKey('$updatedAt', $reconstructed); @@ -402,8 +402,8 @@ public function testCSVExportImportCompatibility() $tagsArray = json_decode($reconstructed['tags'], true); $metadataArray = json_decode($reconstructed['metadata'], true); - $this->assertEquals(['php', 'csv'], $tagsArray); - $this->assertEquals(['key' => 'value'], $metadataArray); + $this->assertSame(['php', 'csv'], $tagsArray); + $this->assertSame(['key' => 'value'], $metadataArray); // Cleanup if (is_dir($tempDir)) { diff --git a/tests/Migration/Unit/General/TransferTest.php b/tests/Migration/Unit/General/TransferTest.php index 02834375..9a14439c 100644 --- a/tests/Migration/Unit/General/TransferTest.php +++ b/tests/Migration/Unit/General/TransferTest.php @@ -39,7 +39,7 @@ public function testRootResourceId(): void $this->transfer->run([Resource::TYPE_USER, Resource::TYPE_DATABASE], function () {}, 'rootResourceId'); $this->fail('Multiple root resources should not be allowed'); } catch (\Exception $e) { - $this->assertEquals('Resource type must be set when resource ID is set.', $e->getMessage()); + $this->assertSame('Resource type must be set when resource ID is set.', $e->getMessage()); } $this->source->pushMockResource(new Database('test', 'test')); @@ -59,7 +59,7 @@ function () {}, $database = $this->destination->getResourceById(Transfer::GROUP_DATABASES, Resource::TYPE_DATABASE, 'test'); /** @var Database $database */ $this->assertNotNull($database); - $this->assertEquals('test', $database->getDatabaseName()); - $this->assertEquals('test', $database->getId()); + $this->assertSame('test', $database->getDatabaseName()); + $this->assertSame('test', $database->getId()); } }