From bf68654819854080e04838b1fcb66f4f300dfb51 Mon Sep 17 00:00:00 2001 From: eparusov Date: Thu, 19 Dec 2024 13:20:07 +0300 Subject: [PATCH] #166: Automatically add .json extension --- src/Traits/FixturesTrait.php | 5 +- tests/CsvIteratorTest.php | 18 +++--- tests/EntityControlTraitTest.php | 2 +- tests/FixturesTraitTest.php | 38 +++++------ tests/HelpersTest.php | 106 +++++++++++++++---------------- tests/MailsMockTraitTest.php | 2 +- tests/ModelTestStateTest.php | 18 +++--- tests/SearchTraitTest.php | 4 +- tests/TableTestStateTest.php | 18 +++--- 9 files changed, 106 insertions(+), 105 deletions(-) diff --git a/src/Traits/FixturesTrait.php b/src/Traits/FixturesTrait.php index 95412da..c8a5ecc 100644 --- a/src/Traits/FixturesTrait.php +++ b/src/Traits/FixturesTrait.php @@ -54,6 +54,7 @@ trait FixturesTrait protected array $prepareSequencesExceptTables = ['migrations', 'password_resets']; protected string $dumpFileName = 'dump.sql'; + protected string $extension = '.json'; protected function loadTestDump(): void { @@ -96,7 +97,7 @@ public function getFixture(string $fixtureName, $failIfNotExists = true): string public function getJsonFixture(string $fixtureName, $assoc = true) { - return json_decode($this->getFixture($fixtureName), $assoc); + return json_decode($this->getFixture($fixtureName . $this->extension), $assoc); } public function assertEqualsFixture(string $fixture, $data, bool $exportMode = false): void @@ -116,7 +117,7 @@ public function exportJson($fixture, $data): void $data = $data->json(); } - $this->exportContent(json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE), $fixture); + $this->exportContent(json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE), $fixture . $this->extension); } public function clearDatabase(array $tables, array $except): void diff --git a/tests/CsvIteratorTest.php b/tests/CsvIteratorTest.php index 7307ee6..9b542a1 100644 --- a/tests/CsvIteratorTest.php +++ b/tests/CsvIteratorTest.php @@ -36,7 +36,7 @@ public function testOpenNotExistsFile() public function testParseColumns() { - $header = $this->getJsonFixture('header.json'); + $header = $this->getJsonFixture('header'); $this->csvIteratorClass->parseColumns($header); @@ -47,7 +47,7 @@ public function testParseColumns() public function testSetColumns() { - $header = $this->getJsonFixture('header.json'); + $header = $this->getJsonFixture('header'); $this->csvIteratorClass->setColumns($header); @@ -60,7 +60,7 @@ public function testCurrent() { $currentLine = $this->csvIteratorClass->current(); - $this->assertEqualsFixture('current_line.json', $currentLine); + $this->assertEqualsFixture('current_line', $currentLine); } public function testKey() @@ -78,7 +78,7 @@ public function testNext() $currentLine = $this->csvIteratorClass->current(); $this->assertEquals(1, $rowKey); - $this->assertEqualsFixture('current_after_next_line.json', $currentLine); + $this->assertEqualsFixture('current_after_next_line', $currentLine); } public function testRewind() @@ -90,7 +90,7 @@ public function testRewind() $currentLine = $this->csvIteratorClass->current(); $this->assertEquals(1, $rowKey); - $this->assertEqualsFixture('current_after_next_line.json', $currentLine); + $this->assertEqualsFixture('current_after_next_line', $currentLine); } public function testGeneratorWithoutSettingColumnHeaders() @@ -105,13 +105,13 @@ public function testGeneratorWithoutSettingColumnHeaders() $rowKey = $this->csvIteratorClass->key(); $this->assertEquals(7, $rowKey); - $this->assertEqualsFixture('all_data.json', $result); + $this->assertEqualsFixture('all_data', $result); } public function testGeneratorWithSettingColumnHeaders() { $result = []; - $header = $this->getJsonFixture('header.json'); + $header = $this->getJsonFixture('header'); $this->filePathProperty->setValue($this->csvIteratorClass, $this->getFixturePath('addresses_without_header.csv')); $this->csvIteratorClass->setColumns($header); @@ -125,7 +125,7 @@ public function testGeneratorWithSettingColumnHeaders() $rowKey = $this->csvIteratorClass->key(); $this->assertEquals(6, $rowKey); - $this->assertEqualsFixture('all_data.json', $result); + $this->assertEqualsFixture('all_data', $result); } public function testGeneratorWithHeadersInvalidCount() @@ -133,7 +133,7 @@ public function testGeneratorWithHeadersInvalidCount() $this->expectException(IncorrectCSVFileException::class); $this->expectExceptionMessage('Incorrect CSV file'); - $header = $this->getJsonFixture('header_invalid_count.json'); + $header = $this->getJsonFixture('header_invalid_count'); $this->csvIteratorClass->setColumns($header); diff --git a/tests/EntityControlTraitTest.php b/tests/EntityControlTraitTest.php index fb03911..880dda3 100644 --- a/tests/EntityControlTraitTest.php +++ b/tests/EntityControlTraitTest.php @@ -39,7 +39,7 @@ public function setUp(): void $this->attachedRelationsCountProperty = new ReflectionProperty(TestRepository::class, 'attachedRelationsCount'); - self::$selectResult ??= $this->getJsonFixture('select_query_result.json'); + self::$selectResult ??= $this->getJsonFixture('select_query_result'); Carbon::setTestNow('2020-01-01 00:00:00'); } diff --git a/tests/FixturesTraitTest.php b/tests/FixturesTraitTest.php index 070ea00..aed7dc8 100644 --- a/tests/FixturesTraitTest.php +++ b/tests/FixturesTraitTest.php @@ -34,7 +34,7 @@ public static function getFixtureData(): array { return [ [ - 'input' => 'get_fixture/exists_fixture.json', + 'input' => 'get_fixture/exists_fixture', ], ]; } @@ -49,11 +49,11 @@ public function testGetFixture(string $input) public function testGetFixtureWithSave() { - $response = $this->getJsonFixture('get_fixture/exists_fixture.json'); + $response = $this->getJsonFixture('get_fixture/exists_fixture'); $this->expectException(ForbiddenExportModeException::class); - $this->assertEqualsFixture('get_fixture/exists_fixture.json', $response, true); + $this->assertEqualsFixture('get_fixture/exists_fixture', $response, true); } public function testExportJson() @@ -64,13 +64,13 @@ public function testExportJson() 'value' => 1234567890, ]; - $this->exportJson('export_json/response.json', new TestResponse( + $this->exportJson('export_json/response', new TestResponse( new Response(json_encode($result)) )); - $this->assertEquals($this->getJsonFixture('export_json/response.json'), $result); + $this->assertEquals($this->getJsonFixture('export_json/response'), $result); - $this->assertFileExists($this->getFixturePath('export_json/response.json')); + $this->assertFileExists($this->getFixturePath('export_json/response.json')); } public function testExportJsonDirNotExists() @@ -85,7 +85,7 @@ public function testExportJsonDirNotExists() $this->exportContent(json_encode($result), $fixtureName); - $this->assertEquals($this->getJsonFixture($fixtureName), $result); + $this->assertEquals($this->getJsonFixture(Str::beforeLast($fixtureName, '.')), $result); $fixturePath = $this->getFixturePath($fixtureName); @@ -112,14 +112,14 @@ public function testExportFile() $this->exportFile($response, 'export_file/content_result.txt'); $this->assertEquals( - expected: $this->getJsonFixture('export_file/result.txt'), - actual: $this->getJsonFixture('export_file/content_result.txt'), + expected: $this->getFixture('export_file/result.txt'), + actual: $this->getFixture('export_file/content_result.txt'), ); } public function testGetFixtureNotExistsWithoutException() { - $response = $this->getFixture('get_fixture/not_exists_fixture.json', false); + $response = $this->getFixture('get_fixture/not_exists_fixture', false); $this->assertEquals('', $response); } @@ -127,9 +127,9 @@ public function testGetFixtureNotExistsWithoutException() public function testGetFixtureNotExistsWithException() { $this->expectException(AssertionFailedError::class); - $this->expectExceptionMessage('not_exists_fixture.json fixture does not exist'); + $this->expectExceptionMessage('not_exists_fixture fixture does not exist'); - $this->getFixture('get_fixture/not_exists_fixture.json'); + $this->getFixture('get_fixture/not_exists_fixture'); } public function testLoadEmptyTestDump() @@ -159,7 +159,7 @@ public function testLoadTestDumpForMysql() Config::set('database.default', 'mysql'); - self::$tables = $this->getJsonFixture('clear_database/tables.json'); + self::$tables = $this->getJsonFixture('clear_database/tables'); $this->loadTestDump(); } @@ -181,7 +181,7 @@ public function testLoadTestDumpForPgsql() Config::set('database.default', 'pgsql'); - self::$tables = $this->getJsonFixture('clear_database/tables.json'); + self::$tables = $this->getJsonFixture('clear_database/tables'); $this->loadTestDump(); } @@ -189,7 +189,7 @@ public function testLoadTestDumpForPgsql() public function testGetTables() { $mock = $this->mockClass(MySqlBuilder::class, [ - $this->functionCall('getTables', [], $this->getJsonFixture('get_tables/tables.json')), + $this->functionCall('getTables', [], $this->getJsonFixture('get_tables/tables')), ], true); $connection = $this->mockClass(MySqlConnection::class, [ @@ -206,12 +206,12 @@ public function testGetTables() $this->getTables(); - $this->assertEqualsFixture('get_tables/tables.json', self::$tables); + $this->assertEqualsFixture('get_tables/tables', self::$tables); } public function testPrepareSequences() { - $sequences = collect($this->getJsonFixture('prepare_sequences/information_schema.json')) + $sequences = collect($this->getJsonFixture('prepare_sequences/information_schema')) ->map(fn ($item) => (object) $item); $connection = $this->mockClass(PostgresConnection::class, [ @@ -239,10 +239,10 @@ public function testPrepareSequences() public function testGetFixtureWithoutGlobalExportMode() { - $content = $this->getJsonFixture('get_fixture/export_fixture.json'); + $content = $this->getJsonFixture('get_fixture/export_fixture'); unset($this->globalExportMode); - $this->assertEqualsFixture('get_fixture/export_fixture.json', $content); + $this->assertEqualsFixture('get_fixture/export_fixture', $content); } } diff --git a/tests/HelpersTest.php b/tests/HelpersTest.php index 3689151..683d4f3 100644 --- a/tests/HelpersTest.php +++ b/tests/HelpersTest.php @@ -13,39 +13,39 @@ public static function getGetListData(): array { return [ [ - 'input' => 'city.json', + 'input' => 'city', 'key' => 'neighborhoods.*.zips.*.state', - 'expected' => 'states.json', + 'expected' => 'states', ], [ - 'input' => 'neighborhood.json', + 'input' => 'neighborhood', 'key' => 'zips.*.code', - 'expected' => 'neighborhood.zips.codes.json', + 'expected' => 'neighborhood.zips.codes', ], [ - 'input' => 'city.json', + 'input' => 'city', 'key' => 'neighborhoods.*.zips.*.code', - 'expected' => 'city.neighborhoods.zips.codes.json', + 'expected' => 'city.neighborhoods.zips.codes', ], [ - 'input' => 'city.json', + 'input' => 'city', 'key' => 'neighborhoods.*.zips', - 'expected' => 'city.neighborhoods.zips.json', + 'expected' => 'city.neighborhoods.zips', ], [ - 'input' => 'city.json', + 'input' => 'city', 'key' => 'neighborhoods', - 'expected' => 'city.neighborhoods.json', + 'expected' => 'city.neighborhoods', ], [ - 'input' => 'neighborhood.json', + 'input' => 'neighborhood', 'key' => 'zips', - 'expected' => 'neighborhood.zips.json', + 'expected' => 'neighborhood.zips', ], [ - 'input' => 'areas.json', + 'input' => 'areas', 'key' => 'zips.*.area.houses.*.number', - 'expected' => 'areas.houses.json', + 'expected' => 'areas.houses', ], ]; } @@ -64,15 +64,15 @@ public static function getIsMultidimensionalData(): array { return [ [ - 'input' => 'areas.houses.json', + 'input' => 'areas.houses', 'expected' => false, ], [ - 'input' => 'areas.json', + 'input' => 'areas', 'expected' => false, ], [ - 'input' => 'city.neighborhoods.json', + 'input' => 'city.neighborhoods', 'expected' => true, ], ]; @@ -92,23 +92,23 @@ public static function getEqualsData(): array { return [ [ - 'firstArray' => 'array_equals/settings.json', - 'secondArray' => 'array_equals/settings_diff.json', + 'firstArray' => 'array_equals/settings', + 'secondArray' => 'array_equals/settings_diff', 'expected' => false, ], [ - 'firstArray' => 'array_equals/settings_rather_types.json', - 'secondArray' => 'array_equals/settings_rather_types_diff_order.json', + 'firstArray' => 'array_equals/settings_rather_types', + 'secondArray' => 'array_equals/settings_rather_types_diff_order', 'expected' => true, ], [ - 'firstArray' => 'array_equals/settings.json', - 'secondArray' => 'array_equals/settings_diff_order.json', + 'firstArray' => 'array_equals/settings', + 'secondArray' => 'array_equals/settings_diff_order', 'expected' => true, ], [ - 'firstArray' => 'areas.houses.json', - 'secondArray' => 'array_equals/non_associative.json', + 'firstArray' => 'areas.houses', + 'secondArray' => 'array_equals/non_associative', 'expected' => true, ], ]; @@ -127,27 +127,27 @@ public function testEquals(string $firstArray, string $secondArray, bool $expect public function testArrayRound() { - $input = $this->getJsonFixture('array_round/values.json'); + $input = $this->getJsonFixture('array_round/values'); $result = array_round($input); - $this->assertEqualsFixture('array_round/rounded_values.json', $result); + $this->assertEqualsFixture('array_round/rounded_values', $result); } public static function getArrayDuplicatesData(): array { return [ [ - 'input' => 'array_get_duplicates/numeric_array.json', - 'expected' => 'array_get_duplicates/numeric_array_duplicates.json', + 'input' => 'array_get_duplicates/numeric_array', + 'expected' => 'array_get_duplicates/numeric_array_duplicates', ], [ - 'input' => 'array_get_duplicates/string_array.json', - 'expected' => 'array_get_duplicates/string_array_duplicates.json', + 'input' => 'array_get_duplicates/string_array', + 'expected' => 'array_get_duplicates/string_array_duplicates', ], [ - 'input' => 'array_get_duplicates/complex_array.json', - 'expected' => 'array_get_duplicates/complex_array_duplicates.json', + 'input' => 'array_get_duplicates/complex_array', + 'expected' => 'array_get_duplicates/complex_array_duplicates', ], ]; } @@ -167,15 +167,15 @@ public static function getArrayUniqueObjectsData(): array return [ [ 'filter' => 'id', - 'expected' => 'array_unique_objects/unique_objects_filtered_by_string_key.json', + 'expected' => 'array_unique_objects/unique_objects_filtered_by_string_key', ], [ 'filter' => ['name'], - 'expected' => 'array_unique_objects/unique_objects_filtered_by_array_key.json', + 'expected' => 'array_unique_objects/unique_objects_filtered_by_array_key', ], [ 'filter' => fn ($objet) => $objet['id'], - 'expected' => 'array_unique_objects/unique_objects_filtered_by_callback_key.json', + 'expected' => 'array_unique_objects/unique_objects_filtered_by_callback_key', ], ]; } @@ -183,7 +183,7 @@ public static function getArrayUniqueObjectsData(): array #[DataProvider('getArrayUniqueObjectsData')] public function testArrayUniqueObjects(string|callable|array $filter, string $expected) { - $input = $this->getJsonFixture('array_unique_objects/array_with_duplicates.json'); + $input = $this->getJsonFixture('array_unique_objects/array_with_duplicates'); $result = array_unique_objects($input, $filter); @@ -192,11 +192,11 @@ public function testArrayUniqueObjects(string|callable|array $filter, string $ex public function testArrayTrim() { - $input = $this->getJsonFixture('array_trim/data.json'); + $input = $this->getJsonFixture('array_trim/data'); $result = array_trim($input); - $this->assertEqualsFixture('array_trim/result.json', $result); + $this->assertEqualsFixture('array_trim/result', $result); } public static function getArrayRemoveByFieldData(): array @@ -205,12 +205,12 @@ public static function getArrayRemoveByFieldData(): array [ 'field' => 'id', 'value' => 1, - 'expected' => 'array_remove_by_field/result_remove_by_id.json', + 'expected' => 'array_remove_by_field/result_remove_by_id', ], [ 'field' => 'name', 'value' => 'test2', - 'expected' => 'array_remove_by_field/result_remove_by_name.json', + 'expected' => 'array_remove_by_field/result_remove_by_name', ], ]; } @@ -218,7 +218,7 @@ public static function getArrayRemoveByFieldData(): array #[DataProvider('getArrayRemoveByFieldData')] public function testArrayRemoveByField(string $field, string|int $value, string $expected) { - $input = $this->getJsonFixture('array_remove_by_field/data.json'); + $input = $this->getJsonFixture('array_remove_by_field/data'); $result = array_remove_by_field($input, $field, $value); @@ -227,16 +227,16 @@ public function testArrayRemoveByField(string $field, string|int $value, string public function testArrayUndot() { - $input = $this->getJsonFixture('array_undot/data.json'); + $input = $this->getJsonFixture('array_undot/data'); $result = array_undot($input); - $this->assertEqualsFixture('array_undot/result.json', $result); + $this->assertEqualsFixture('array_undot/result', $result); } public function testArrayAssociate() { - $input = $this->getJsonFixture('array_associate/data.json'); + $input = $this->getJsonFixture('array_associate/data'); $result = array_associate($input, function ($value, $key) { return [ @@ -245,27 +245,27 @@ public function testArrayAssociate() ]; }); - $this->assertEqualsFixture('array_associate/result.json', $result); + $this->assertEqualsFixture('array_associate/result', $result); } public function testArraySubtraction() { - $input1 = $this->getJsonFixture('array_subtraction/data1.json'); - $input2 = $this->getJsonFixture('array_subtraction/data2.json'); + $input1 = $this->getJsonFixture('array_subtraction/data1'); + $input2 = $this->getJsonFixture('array_subtraction/data2'); $result = array_subtraction($input1, $input2); - $this->assertEqualsFixture('array_subtraction/result.json', $result); + $this->assertEqualsFixture('array_subtraction/result', $result); } public function testArrayRemoveElements() { - $input1 = $this->getJsonFixture('array_remove_elements/data1.json'); - $input2 = $this->getJsonFixture('array_remove_elements/data2.json'); + $input1 = $this->getJsonFixture('array_remove_elements/data1'); + $input2 = $this->getJsonFixture('array_remove_elements/data2'); $result = array_remove_elements($input1, $input2); - $this->assertEqualsFixture('array_remove_elements/result.json', $result); + $this->assertEqualsFixture('array_remove_elements/result', $result); } public function testMkDirRecursively() @@ -303,7 +303,7 @@ public function testClearFolder() public function testFPutQuotedCsv() { - $input = $this->getJsonFixture('fPutQuotedCsv/input.json'); + $input = $this->getJsonFixture('fPutQuotedCsv/input'); $fp = fopen('test.csv', 'w'); diff --git a/tests/MailsMockTraitTest.php b/tests/MailsMockTraitTest.php index 26a9036..f608f54 100644 --- a/tests/MailsMockTraitTest.php +++ b/tests/MailsMockTraitTest.php @@ -102,7 +102,7 @@ public function testMailWhenEmailChainIsJson() Mail::to('test1@mail.com')->queue($mail1->subject('Test Subject1')); Mail::to('test2@mail.com')->queue($mail2->subject('Test Subject2')); - $this->assertMailEquals(TestMail::class, 'email_chain.json'); + $this->assertMailEquals(TestMail::class, 'email_chain'); } public function testMailWithExport() diff --git a/tests/ModelTestStateTest.php b/tests/ModelTestStateTest.php index 3fc9b81..3142f24 100644 --- a/tests/ModelTestStateTest.php +++ b/tests/ModelTestStateTest.php @@ -22,8 +22,8 @@ public function setUp(): void public function testInitialization() { - $datasetMock = collect($this->getJsonFixture('initialization/dataset.json')); - $originRecords = collect($this->getJsonFixture('initialization/origin_records.json')); + $datasetMock = collect($this->getJsonFixture('initialization/dataset')); + $originRecords = collect($this->getJsonFixture('initialization/origin_records')); $this->mockGettingDataset($datasetMock); @@ -39,33 +39,33 @@ public function testInitialization() public function testAssertChangesEqualsFixture() { - $initialDatasetMock = collect($this->getJsonFixture('changes_equals_fixture/initial_dataset.json')); - $changedDatasetMock = collect($this->getJsonFixture('changes_equals_fixture/changed_dataset.json')); + $initialDatasetMock = collect($this->getJsonFixture('changes_equals_fixture/initial_dataset')); + $changedDatasetMock = collect($this->getJsonFixture('changes_equals_fixture/changed_dataset')); $this->mockGettingDatasetForChanges($changedDatasetMock, $initialDatasetMock, 'test_models'); $modelTestState = new ModelTestState(TestModel::class); - $modelTestState->assertChangesEqualsFixture('assertion_fixture.json'); + $modelTestState->assertChangesEqualsFixture('assertion_fixture'); } public function testAssertChangesWithoutJsonFields() { $initialDatasetMock = collect( - $this->getJsonFixture('changes_equals_fixture_without_json_fields/initial_dataset.json'), + $this->getJsonFixture('changes_equals_fixture_without_json_fields/initial_dataset'), ); $changedDatasetMock = collect( - $this->getJsonFixture('changes_equals_fixture_without_json_fields/changed_dataset.json'), + $this->getJsonFixture('changes_equals_fixture_without_json_fields/changed_dataset'), ); $this->mockGettingDatasetForChanges($changedDatasetMock, $initialDatasetMock, 'test_model_without_json_fields'); $modelTestState = new ModelTestState(TestModelWithoutJsonFields::class); - $modelTestState->assertChangesEqualsFixture('assertion_fixture_without_json_fields.json'); + $modelTestState->assertChangesEqualsFixture('assertion_fixture_without_json_fields'); } public function testAssertNoChanges() { - $datasetMock = collect($this->getJsonFixture('get_without_changes/dataset.json')); + $datasetMock = collect($this->getJsonFixture('get_without_changes/dataset')); $this->mockGettingDatasetForChanges($datasetMock, $datasetMock, 'test_models'); diff --git a/tests/SearchTraitTest.php b/tests/SearchTraitTest.php index 65be9ac..ff37911 100644 --- a/tests/SearchTraitTest.php +++ b/tests/SearchTraitTest.php @@ -54,7 +54,7 @@ public function setUp(): void $reflectionClass = new ReflectionClass(TestRepository::class); $this->setAdditionalReservedFiltersMethod = $reflectionClass->getMethod('setAdditionalReservedFilters'); - self::$selectResult ??= $this->getJsonFixture('select_query_result.json'); + self::$selectResult ??= $this->getJsonFixture('select_query_result'); } public function testSearchQuery() @@ -82,7 +82,7 @@ public function testSearchQuery() $this->assertEquals(['relation'], $attachedRelations); $this->assertEquals(['relation'], $attachedRelationsCount); - $this->assertEqualsFixture('search_query_sql.json', $sql); + $this->assertEqualsFixture('search_query_sql', $sql); } public function testGetSearchResultWithAll() diff --git a/tests/TableTestStateTest.php b/tests/TableTestStateTest.php index 1b1680a..ebd2413 100644 --- a/tests/TableTestStateTest.php +++ b/tests/TableTestStateTest.php @@ -11,8 +11,8 @@ class TableTestStateTest extends HelpersTestCase public function testInitialization() { - $datasetMock = collect($this->getJsonFixture('initialization/dataset.json')); - $originRecords = collect($this->getJsonFixture('initialization/origin_records.json')); + $datasetMock = collect($this->getJsonFixture('initialization/dataset')); + $originRecords = collect($this->getJsonFixture('initialization/origin_records')); $this->mockGettingDataset($datasetMock); @@ -28,33 +28,33 @@ public function testInitialization() public function testAssertChangesEqualsFixture() { - $initialDatasetMock = collect($this->getJsonFixture('changes_equals_fixture/initial_dataset.json')); - $changedDatasetMock = collect($this->getJsonFixture('changes_equals_fixture/changed_dataset.json')); + $initialDatasetMock = collect($this->getJsonFixture('changes_equals_fixture/initial_dataset')); + $changedDatasetMock = collect($this->getJsonFixture('changes_equals_fixture/changed_dataset')); $this->mockGettingDatasetForChanges($changedDatasetMock, $initialDatasetMock, 'test_models'); $modelTestState = new TableTestState('test_models', ['json_field', 'castable_field']); - $modelTestState->assertChangesEqualsFixture('assertion_fixture.json'); + $modelTestState->assertChangesEqualsFixture('assertion_fixture'); } public function testAssertChangesWithoutJsonFields() { $initialDatasetMock = collect( - $this->getJsonFixture('changes_equals_fixture_without_json_fields/initial_dataset.json'), + $this->getJsonFixture('changes_equals_fixture_without_json_fields/initial_dataset'), ); $changedDatasetMock = collect( - $this->getJsonFixture('changes_equals_fixture_without_json_fields/changed_dataset.json'), + $this->getJsonFixture('changes_equals_fixture_without_json_fields/changed_dataset'), ); $this->mockGettingDatasetForChanges($changedDatasetMock, $initialDatasetMock, 'test_models'); $modelTestState = new TableTestState('test_models'); - $modelTestState->assertChangesEqualsFixture('assertion_fixture_without_json_fields.json'); + $modelTestState->assertChangesEqualsFixture('assertion_fixture_without_json_fields'); } public function testAssertNoChanges() { - $datasetMock = collect($this->getJsonFixture('get_without_changes/dataset.json')); + $datasetMock = collect($this->getJsonFixture('get_without_changes/dataset')); $this->mockGettingDatasetForChanges($datasetMock, $datasetMock, 'test_models');