-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add more fields to GraphQL Build type
- Loading branch information
1 parent
14ac22b
commit d2deb87
Showing
4 changed files
with
188 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
<?php | ||
|
||
namespace Tests\Feature\GraphQL; | ||
|
||
use App\Models\Project; | ||
use Illuminate\Support\Str; | ||
use Tests\TestCase; | ||
use Tests\Traits\CreatesProjects; | ||
use Tests\Traits\CreatesUsers; | ||
|
||
class BuildTypeTest extends TestCase | ||
{ | ||
use CreatesUsers; | ||
use CreatesProjects; | ||
|
||
private Project $project; | ||
|
||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$this->project = Project::findOrFail((int) $this->makePublicProject()->Id); | ||
} | ||
|
||
protected function tearDown(): void | ||
{ | ||
// Deleting the project will delete all corresponding builds | ||
$this->project->delete(); | ||
|
||
parent::tearDown(); | ||
} | ||
|
||
/** | ||
* A basic test to ensure that each of the fields works | ||
*/ | ||
public function testBasicFieldAccess(): void | ||
{ | ||
$uuid = Str::uuid()->toString(); | ||
$this->project->builds()->create([ | ||
'stamp' => 'abcdefg', | ||
'name' => 'build1', | ||
'type' => 'Continuous', | ||
'generator' => 'ctest-2.9.20091218', | ||
'starttime' => '2011-07-22 15:11:41', | ||
'endtime' => '2011-07-22 15:29:30', | ||
'submittime' => '2024-03-21 20:30:51', | ||
'command' => 'foo bar', | ||
'log' => 'abc', | ||
'configureerrors' => 1, | ||
'configurewarnings' => 2, | ||
'configureduration' => 10, | ||
'builderrors' => 3, | ||
'buildwarnings' => 4, | ||
'buildduration' => 20, | ||
'testnotrun' => 5, | ||
'testfailed' => 6, | ||
'testpassed' => 7, | ||
'testtimestatusfailed' => 8, | ||
'testduration' => 30, | ||
'uuid' => $uuid, | ||
]); | ||
|
||
$this->graphQL(' | ||
query project($id: ID) { | ||
project(id: $id) { | ||
builds { | ||
stamp | ||
name | ||
buildType | ||
generator | ||
startTime | ||
endTime | ||
submissionTime | ||
command | ||
log | ||
configureErrorsCount | ||
configureWarningsCount | ||
configureDuration | ||
buildErrorsCount | ||
buildWarningsCount | ||
buildDuration | ||
notRunTestsCount | ||
failedTestsCount | ||
passedTestsCount | ||
timeStatusFailedTestsCount | ||
testDuration | ||
uuid | ||
} | ||
} | ||
} | ||
', [ | ||
'id' => $this->project->id, | ||
])->assertJson([ | ||
'data' => [ | ||
'project' => [ | ||
'builds' => [ | ||
[ | ||
'stamp' => 'abcdefg', | ||
'name' => 'build1', | ||
'buildType' => 'Continuous', | ||
'generator' => 'ctest-2.9.20091218', | ||
'startTime' => '2011-07-22 15:11:41', | ||
'endTime' => '2011-07-22 15:29:30', | ||
'submissionTime' => '2024-03-21 20:30:51', | ||
'command' => 'foo bar', | ||
'log' => 'abc', | ||
'configureErrorsCount' => 1, | ||
'configureWarningsCount' => 2, | ||
'configureDuration' => 10, | ||
'buildErrorsCount' => 3, | ||
'buildWarningsCount' => 4, | ||
'buildDuration' => 20, | ||
'notRunTestsCount' => 5, | ||
'failedTestsCount' => 6, | ||
'passedTestsCount' => 7, | ||
'timeStatusFailedTestsCount' => 8, | ||
'testDuration' => 30, | ||
'uuid' => $uuid, | ||
], | ||
], | ||
], | ||
], | ||
], true); | ||
} | ||
} |