Skip to content

Commit

Permalink
refactor: test
Browse files Browse the repository at this point in the history
  • Loading branch information
yogyrton committed Dec 25, 2024
1 parent 5ded04f commit 10a4df6
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions tests/FixturesTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,29 @@ public function testExportJson()
$this->assertFileExists($this->getFixturePath('export_json/response.json'));
}

public function testFixtureWithoutExtension()
public function testGetJsonFixtureWithoutExtension()
{
$response = $this->getJsonFixture('get_fixture/exists_fixture');

$this->assertEqualsFixture('get_fixture/exists_fixture.json', $response);
}

public function testExportJsonWithoutExtension()
{
putenv('FAIL_EXPORT_JSON=false');

$fixturePath = $this->getFixturePath('export_json/response.json');

if (file_exists($fixturePath)) {
unlink($fixturePath);
}

$result = ['value' => 1234567890];

$this->exportJson('export_json/response', new TestResponse(
new Response(json_encode($result))
));

$this->assertEquals($this->getJsonFixture('export_json/response'), $result);

$this->assertFileExists($this->getFixturePath('export_json/response.json'));
}

Expand Down

0 comments on commit 10a4df6

Please sign in to comment.