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
77 changes: 39 additions & 38 deletions app/Utils/TestCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use CDash\Model\Build;
use CDash\Model\Image;
use ErrorException;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;

/**
Expand Down Expand Up @@ -136,46 +137,46 @@ public function create(Build $build): void
}
}

$outputid = TestOutput::firstOrCreate([
'path' => $this->testPath,
'command' => $this->testCommand,
'output' => $this->testOutput,
])->id;

// build2test
$buildtest = new Test();
$buildtest->buildid = $build->Id;
$buildtest->outputid = $outputid;
$buildtest->status = $this->testStatus;
$buildtest->details = $this->testDetails;
$buildtest->time = "$this->buildTestTime";
$buildtest->testname = $this->testName;
$buildtest->starttime = $this->testStartTime;

// Note: the newstatus column is currently handled in
// ctestparserutils::compute_test_difference. This gets updated when we call
// Build::ComputeTestTiming.
$buildtest->save();

foreach ($this->measurements as $measurement) {
$measurement->testid = $buildtest->id;
$measurement->save();
}
DB::transaction(function () use ($build): void {
$outputid = TestOutput::select('id')->firstOrCreate([
'path' => $this->testPath,
'command' => $this->testCommand,
'output' => $this->testOutput,
])->id;

// Note: the newstatus column is currently handled in
// ctestparserutils::compute_test_difference. This gets updated when we call
// Build::ComputeTestTiming.
$buildtest = Test::create([
'buildid' => $build->Id,
'outputid' => $outputid,
'status' => $this->testStatus,
'details' => $this->testDetails,
'time' => "$this->buildTestTime",
'testname' => $this->testName,
'starttime' => $this->testStartTime,
]);

foreach ($this->measurements as $measurement) {
$measurement->testid = $buildtest->id;
$measurement->save();
}

// Give measurements to the buildtest model so we can properly calculate
// proctime later on.
$buildtest->measurements = $this->measurements;
$build->AddTest($buildtest);
// Give measurements to the buildtest model so we can properly calculate
// proctime later on.
$buildtest->measurements = $this->measurements;
$build->AddTest($buildtest);

foreach ($this->labels as $label) {
$label->Test = $buildtest;
$label->Insert();
$buildtest->addLabel($label);
}
foreach ($this->labels as $label) {
$label->Test = $buildtest;
$label->Insert();
$buildtest->addLabel($label);
}

// test2image
foreach ($this->images as $image) {
$this->saveImage($image, $buildtest->id);
}
// test2image
foreach ($this->images as $image) {
$this->saveImage($image, $buildtest->id);
}
});
}
}
6 changes: 0 additions & 6 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -7050,12 +7050,6 @@ parameters:
count: 1
path: app/Utils/TestCreator.php

-
rawMessage: 'Property App\Models\Test::$time (float) does not accept string.'
identifier: assign.propertyType
count: 1
path: app/Utils/TestCreator.php

-
rawMessage: Property App\Utils\TestCreator::$alreadyCompressed has no type specified.
identifier: missingType.property
Expand Down