fix integration tests
This commit is contained in:
parent
b966069946
commit
2948e344d2
2 changed files with 16 additions and 5 deletions
|
@ -28,6 +28,18 @@ class EggTransformer extends Transformer
|
|||
|
||||
public function transform(Egg $model): array
|
||||
{
|
||||
// Fixes PHP returning an empty array rather than an empty object.
|
||||
// Removing associative = true would also fix this, but that causes
|
||||
// the tests to fail and may have other undiscovered side effects.
|
||||
$configFiles = json_decode($model->config_files, true);
|
||||
if ($configFiles === []) {
|
||||
$configFiles = new \stdClass();
|
||||
}
|
||||
$configStartup = json_decode($model->config_startup, true);
|
||||
if ($configStartup === []) {
|
||||
$configStartup = new \stdClass();
|
||||
}
|
||||
|
||||
return [
|
||||
'id' => $model->id,
|
||||
'uuid' => $model->uuid,
|
||||
|
@ -41,8 +53,8 @@ class EggTransformer extends Transformer
|
|||
'docker_image' => count($model->docker_images) > 0 ? $model->docker_images[0] : '',
|
||||
'docker_images' => $model->docker_images,
|
||||
'config' => [
|
||||
'files' => json_decode($model->config_files),
|
||||
'startup' => json_decode($model->config_startup),
|
||||
'files' => $configFiles,
|
||||
'startup' => $configStartup,
|
||||
'stop' => $model->config_stop,
|
||||
'file_denylist' => $model->file_denylist,
|
||||
'extends' => $model->config_from,
|
||||
|
|
|
@ -23,7 +23,7 @@ class EggControllerTest extends ApplicationApiIntegrationTestCase
|
|||
}
|
||||
|
||||
/**
|
||||
* Test that all of the eggs belonging to a given nest can be returned.
|
||||
* Test that all the eggs belonging to a given nest can be returned.
|
||||
*/
|
||||
public function testListAllEggsInNest()
|
||||
{
|
||||
|
@ -44,7 +44,6 @@ class EggControllerTest extends ApplicationApiIntegrationTestCase
|
|||
'files' => [],
|
||||
'startup' => ['done'],
|
||||
'stop',
|
||||
'logs' => ['custom', 'location'],
|
||||
'extends',
|
||||
],
|
||||
],
|
||||
|
@ -89,7 +88,7 @@ class EggControllerTest extends ApplicationApiIntegrationTestCase
|
|||
}
|
||||
|
||||
/**
|
||||
* Test that a single egg and all of the defined relationships can be returned.
|
||||
* Test that a single egg and all the defined relationships can be returned.
|
||||
*/
|
||||
public function testReturnSingleEggWithRelationships()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue