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: 29 additions & 2 deletions app/Models/Project.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
* @property bool $emailbrokensubmission
* @property bool $emailredundantfailures
* @property ?string $cvsviewertype
* @property int $testtimestd
* @property int $testtimestdthreshold
* @property float $testtimestd
* @property float $testtimestdthreshold
* @property bool $showtesttime
* @property int $testtimemaxstatus
* @property int $emailmaxitems
Expand Down Expand Up @@ -108,6 +108,33 @@ class Project extends Model
'coveragethreshold' => 'integer',
'showcoveragecode' => 'boolean',
'authenticatesubmissions' => 'boolean',
'testtimestd' => 'float',
'testtimestdthreshold' => 'float',
'testtimemaxstatus' => 'integer',
'emailmaxitems' => 'integer',
'emailmaxchars' => 'integer',
'autoremovetimeframe' => 'integer',
'uploadquota' => 'integer',
];

protected $attributes = [
'coveragethreshold' => 70,
'nightlytime' => '00:00:00',
'emaillowcoverage' => false,
'emailtesttimingchanged' => false,
'emailbrokensubmission' => true,
'emailredundantfailures' => false,
'testtimestd' => 4,
'testtimestdthreshold' => 1,
'showtesttime' => false,
'testtimemaxstatus' => 3,
'emailmaxitems' => 5,
'emailmaxchars' => 255,
'displaylabels' => true,
'autoremovetimeframe' => 90,
'uploadquota' => 10,
'showcoveragecode' => true,
'authenticatesubmissions' => false,
];

public const PROJECT_ADMIN = 2;
Expand Down
8 changes: 5 additions & 3 deletions app/cdash/tests/case/CDash/MultipleSubprojectsEmailTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,12 @@
use Illuminate\Support\Facades\URL;
use Illuminate\Support\Str;
use PHPUnit\Framework\MockObject\MockObject;
use Tests\Traits\CreatesProjects;

class MultipleSubprojectsEmailTest extends CDashUseCaseTestCase
{
use CreatesProjects;

private static $tz;
private static $database;

Expand Down Expand Up @@ -109,9 +112,8 @@ public function setUp(): void
URL::forceRootUrl('http://open.cdash.org');

if (self::$projectid === -1) {
self::$projectid = DB::table('project')->insertGetId([
'name' => 'TestProject1',
]);
$project = $this->makePublicProject('TestProject1');
self::$projectid = $project->id;

// A hack to make sure builds exist and can be referenced so we don't violate our foreign key constraints
for ($i = 0; $i < 10; $i++) {
Expand Down
8 changes: 5 additions & 3 deletions app/cdash/tests/case/CDash/TestUseCaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,19 @@
use CDash\Test\UseCase\UseCase;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB;
use Tests\Traits\CreatesProjects;

class TestUseCaseTest extends CDashUseCaseTestCase
{
use CreatesProjects;

private int $projectid = -1;

public function setUp(): void
{
$this->createApplication();
$this->projectid = DB::table('project')->insertGetId([
'name' => 'TestProject1',
]);
$project = $this->makePublicProject('TestProject1');
$this->projectid = $project->id;

// A hack to make sure builds exist and can be referenced so we don't violate our foreign key constraints
for ($i = 0; $i < 10; $i++) {
Expand Down
1 change: 1 addition & 0 deletions app/cdash/tests/test_buildmodel.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public function __construct()

$project = Project::create([
'name' => 'BuildModel',
'public' => Project::ACCESS_PUBLIC,
]);

DB::table('buildgroup')->insertOrIgnore([
Expand Down
33 changes: 33 additions & 0 deletions database/migrations/2026_05_20_202347_project_defaults.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;

return new class extends Migration {
public function up(): void
{
DB::statement('ALTER TABLE project ALTER COLUMN name DROP DEFAULT');
DB::statement('ALTER TABLE project ALTER COLUMN public DROP DEFAULT');
DB::statement('ALTER TABLE project ALTER COLUMN coveragethreshold DROP DEFAULT');
DB::statement('ALTER TABLE project ALTER COLUMN nightlytime DROP DEFAULT');
DB::statement('ALTER TABLE project ALTER COLUMN emaillowcoverage DROP DEFAULT');
DB::statement('ALTER TABLE project ALTER COLUMN emailtesttimingchanged DROP DEFAULT');
DB::statement('ALTER TABLE project ALTER COLUMN emailbrokensubmission DROP DEFAULT');
DB::statement('ALTER TABLE project ALTER COLUMN emailredundantfailures DROP DEFAULT');
DB::statement('ALTER TABLE project ALTER COLUMN testtimestd DROP DEFAULT');
DB::statement('ALTER TABLE project ALTER COLUMN testtimestdthreshold DROP DEFAULT');
DB::statement('ALTER TABLE project ALTER COLUMN showtesttime DROP DEFAULT');
DB::statement('ALTER TABLE project ALTER COLUMN testtimemaxstatus DROP DEFAULT');
DB::statement('ALTER TABLE project ALTER COLUMN emailmaxitems DROP DEFAULT');
DB::statement('ALTER TABLE project ALTER COLUMN emailmaxchars DROP DEFAULT');
DB::statement('ALTER TABLE project ALTER COLUMN displaylabels DROP DEFAULT');
DB::statement('ALTER TABLE project ALTER COLUMN autoremovetimeframe DROP DEFAULT');
DB::statement('ALTER TABLE project ALTER COLUMN uploadquota DROP DEFAULT');
DB::statement('ALTER TABLE project ALTER COLUMN showcoveragecode DROP DEFAULT');
DB::statement('ALTER TABLE project ALTER COLUMN authenticatesubmissions DROP DEFAULT');
}

public function down(): void
{
}
};
5 changes: 1 addition & 4 deletions tests/Browser/Pages/CreateProjectPageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use App\Models\Project;
use App\Models\User;
use App\Services\ProjectService;
use Illuminate\Support\Str;
use Laravel\Dusk\Browser;
use PHPUnit\Framework\Attributes\DataProvider;
Expand Down Expand Up @@ -88,9 +87,7 @@ public function testShowsErrorWhenProjectAlreadyExists(): void

$project_name = Str::uuid()->toString();

$this->projects[] = ProjectService::create([
'name' => $project_name,
]);
$this->projects[] = $this->makePublicProject($project_name);

$this->browse(function (Browser $browser) use ($project_name): void {
$browser->loginAs($this->users['admin'])
Expand Down
10 changes: 5 additions & 5 deletions tests/Feature/AutoRemoveBuildsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@
namespace Tests\Feature;

use App\Models\Project;
use App\Services\ProjectService;
use CDash\Database;
use CDash\Model\Build;
use DateTime;
use DateTimeZone;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Tests\TestCase;
use Tests\Traits\CreatesProjects;

class AutoRemoveBuildsCommand extends TestCase
{
use CreatesProjects;
use DatabaseTransactions;

protected Project $project;
Expand All @@ -21,10 +22,9 @@ public function setUp(): void
{
parent::setUp();

$this->project = ProjectService::create([
'name' => 'AutoRemoveProject',
'autoremovetimeframe' => 45,
]);
$this->project = $this->makePublicProject('AutoRemoveProject');
$this->project->autoremovetimeframe = 45;
$this->project->save();
}

public function tearDown(): void
Expand Down
4 changes: 2 additions & 2 deletions tests/Feature/GraphQL/Mutations/UpdateProjectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ public static function fieldValues(): array
['emailTestTimingChanged', true, 'emailtesttimingchanged', true],
['emailBrokenSubmissions', true, 'emailbrokensubmission', true],
['emailRedundantFailures', true, 'emailredundantfailures', true],
['testTimeStdMultiplier', 5.0, 'testtimestd', '5.00'],
['testTimeStdThreshold', 2.0, 'testtimestdthreshold', '2.00'],
['testTimeStdMultiplier', 5.0, 'testtimestd', 5.0],
['testTimeStdThreshold', 2.0, 'testtimestdthreshold', 2.0],
['enableTestTiming', false, 'showtesttime', false],
['timeStatusFailureThreshold', 3, 'testtimemaxstatus', 3],
['emailMaxItems', 20, 'emailmaxitems', 20],
Expand Down