Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions app/Models/Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Carbon\Carbon;
use CDash\Model\Label;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
Expand Down Expand Up @@ -131,6 +132,36 @@ public function testImages(): HasMany
return $this->hasMany(TestImage::class, 'testid');
}

/**
* @return Attribute<?string,null>
*/
protected function path(): Attribute
{
return Attribute::make(
get: fn (mixed $value, array $attributes): ?string => $this->testOutput->path ?? null,
);
}

/**
* @return Attribute<?string,null>
*/
protected function command(): Attribute
{
return Attribute::make(
get: fn (mixed $value, array $attributes): ?string => $this->testOutput->command ?? null,
);
}

/**
* @return Attribute<?string,null>
*/
protected function output(): Attribute
{
return Attribute::make(
get: fn (mixed $value, array $attributes): ?string => $this->testOutput->output ?? null,
);
}

/**
* Add a label to this buildtest.
*
Expand Down
6 changes: 6 additions & 0 deletions graphql/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -889,6 +889,12 @@ type Test {

details: String! @filterable

path: String @with(relation: "testOutput")

command: String @with(relation: "testOutput")

output: String @with(relation: "testOutput")

testMeasurements(
filters: _ @filter
): [TestMeasurement!]! @hasMany @orderBy(column: "id", direction: DESC)
Expand Down
7 changes: 7 additions & 0 deletions tests/Feature/GraphQL/TestTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Tests\Feature\GraphQL;

use App\Models\Project;
use App\Models\Test;
use App\Models\TestOutput;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Support\Str;
Expand Down Expand Up @@ -80,6 +81,9 @@ public function testBasicFieldAccess(): void
details
runningTime
startTime
path
command
output
}
}
}
Expand Down Expand Up @@ -107,6 +111,9 @@ public function testBasicFieldAccess(): void
'details' => 'details text',
'runningTime' => 1.2,
'startTime' => '2026-02-13T18:03:54+00:00',
'path' => 'a',
'command' => 'b',
'output' => 'c',
],
],
],
Expand Down