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
119 changes: 0 additions & 119 deletions app/Http/Controllers/ManageMeasurementsController.php

This file was deleted.

37 changes: 4 additions & 33 deletions app/cdash/tests/test_managemeasurements.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
use App\Models\PinnedTestMeasurement;
use App\Utils\DatabaseCleanupUtils;
use CDash\Database;
use GuzzleHttp\Exception\ClientException;

class ManageMeasurementsTestCase extends KWWebTestCase
{
Expand Down Expand Up @@ -154,46 +153,18 @@ public function testManageMeasurements()
$this->PDO->execute($stmt, [':buildid' => $this->BuildId]);
$this->assertEqual(12.13, $stmt->fetchColumn());

// Login as admin.
$client = $this->getGuzzleClient();

// POST to manageMeasurements.php to add 'Processors', 'I/O Wait Time',
// and 'Peak Memory' as test measurements for these projects.
// Add 'Processors', 'I/O Wait Time', and 'Peak Memory' as test measurements for these projects.
$this->ProjectId = get_project_id('InsightExample');
$this->SubProjectId = get_project_id('SubProjectExample');
$new_measurements = ['Processors', 'I/O Wait Time', 'Peak Memory'];
$idx = 1;
foreach ($new_measurements as $new_measurement) {
foreach ([$this->ProjectId, $this->SubProjectId] as $projectid) {
$measurements = [];
$measurements[] = [
'id' => -1,
PinnedTestMeasurement::create([
'projectid' => $projectid,
'name' => $new_measurement,
'position' => $idx,
];
try {
$response = $client->request('POST',
$this->url . '/api/v1/manageMeasurements.php',
['json' => ['projectid' => $projectid, 'measurements' => $measurements]]);
} catch (ClientException $e) {
$this->fail($e->getMessage());
return false;
}

// Response should have the ID of the newly created measurement.
$response_array = json_decode($response->getBody(), true);
$measurement_id = $response_array['id'];
if (!$measurement_id > 0) {
$this->fail("Expected positive integer for measurement ID, found $measurement_id");
}
$this->MeasurementIds[] = $measurement_id;
// Check that the measurement actually got added to the database.
$stmt = $this->PDO->query(
"SELECT id FROM measurement WHERE id = $measurement_id");
$found = $stmt->fetchColumn();
if ($found != $measurement_id) {
$this->fail("Expected $measurement_id but found $found for DB measurement ID");
}
]);
}
$idx++;
}
Expand Down
20 changes: 5 additions & 15 deletions app/cdash/tests/test_redundanttests.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

require_once __DIR__ . '/cdash_test_case.php';

use App\Models\PinnedTestMeasurement;
use CDash\Model\Project;
use GuzzleHttp\Exception\ClientException;
use Illuminate\Support\Facades\DB;

class RedundantTestsTestCase extends KWWebTestCase
Expand All @@ -26,7 +26,7 @@ public function __destruct()
}
}

public function testRedundantTests()
public function testRedundantTests(): void
{
// Create test project.
$this->login();
Expand All @@ -38,21 +38,11 @@ public function testRedundantTests()
$this->project->Fill();

// Add 'color' as a custom test measurement for this project.
$client = $this->getGuzzleClient();
$measurements = [];
$measurements[] = [
'id' => -1,
PinnedTestMeasurement::create([
'projectid' => $this->project->Id,
'name' => 'color',
'position' => 1,
];
try {
$client->request('POST',
$this->url . '/api/v1/manageMeasurements.php',
['json' => ['projectid' => $this->project->Id, 'measurements' => $measurements]]);
} catch (ClientException $e) {
$this->fail($e->getMessage());
return false;
}
]);

// Submit our testing data.
if (!$this->submission('RedundantTests', __DIR__ . '/data/RedundantTests/Test.xml')) {
Expand Down
102 changes: 0 additions & 102 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -861,78 +861,6 @@ parameters:
count: 1
path: app/Http/Controllers/IndexController.php

-
rawMessage: 'Call to an undefined method App\Models\Project|Illuminate\Database\Eloquent\Collection<int, App\Models\Project>::pinnedTestMeasurements().'
identifier: method.notFound
count: 2
path: app/Http/Controllers/ManageMeasurementsController.php

-
rawMessage: Cannot access offset 'id' on mixed.
identifier: offsetAccess.nonOffsetAccessible
count: 1
path: app/Http/Controllers/ManageMeasurementsController.php

-
rawMessage: Cannot access offset 'name' on mixed.
identifier: offsetAccess.nonOffsetAccessible
count: 1
path: app/Http/Controllers/ManageMeasurementsController.php

-
rawMessage: Cannot access offset 'position' on mixed.
identifier: offsetAccess.nonOffsetAccessible
count: 1
path: app/Http/Controllers/ManageMeasurementsController.php

-
rawMessage: Cannot access property $id on App\Models\PinnedTestMeasurement|null.
identifier: property.nonObject
count: 1
path: app/Http/Controllers/ManageMeasurementsController.php

-
rawMessage: Cannot access property $name on App\Models\PinnedTestMeasurement|null.
identifier: property.nonObject
count: 1
path: app/Http/Controllers/ManageMeasurementsController.php

-
rawMessage: Cannot access property $position on App\Models\PinnedTestMeasurement|null.
identifier: property.nonObject
count: 1
path: app/Http/Controllers/ManageMeasurementsController.php

-
rawMessage: Cannot access property $projectid on App\Models\PinnedTestMeasurement|null.
identifier: property.nonObject
count: 1
path: app/Http/Controllers/ManageMeasurementsController.php

-
rawMessage: 'Cannot call method save() on App\Models\PinnedTestMeasurement|null.'
identifier: method.nonObject
count: 1
path: app/Http/Controllers/ManageMeasurementsController.php

-
rawMessage: Cannot cast mixed to int.
identifier: cast.int
count: 4
path: app/Http/Controllers/ManageMeasurementsController.php

-
rawMessage: 'Only booleans are allowed in an if condition, int|null given.'
identifier: if.condNotBoolean
count: 1
path: app/Http/Controllers/ManageMeasurementsController.php

-
rawMessage: 'Only booleans are allowed in an if condition, mixed given.'
identifier: if.condNotBoolean
count: 1
path: app/Http/Controllers/ManageMeasurementsController.php

-
rawMessage: 'Binary operation "-" between int<1, max> and mixed results in an error.'
identifier: binaryOp.invalid
Expand Down Expand Up @@ -20154,12 +20082,6 @@ parameters:
count: 2
path: app/cdash/tests/test_managemeasurements.php

-
rawMessage: Cannot access offset 'id' on mixed.
identifier: offsetAccess.nonOffsetAccessible
count: 1
path: app/cdash/tests/test_managemeasurements.php

-
rawMessage: Cannot access offset 'label' on mixed.
identifier: offsetAccess.nonOffsetAccessible
Expand Down Expand Up @@ -20250,12 +20172,6 @@ parameters:
count: 5
path: app/cdash/tests/test_managemeasurements.php

-
rawMessage: 'Loose comparison via "!=" between mixed and mixed is not allowed.'
identifier: notEqual.notAllowed
count: 1
path: app/cdash/tests/test_managemeasurements.php

-
rawMessage: 'Loose comparison via "!=" between string and float is not allowed.'
identifier: notEqual.notAllowed
Expand Down Expand Up @@ -20334,12 +20250,6 @@ parameters:
count: 1
path: app/cdash/tests/test_managemeasurements.php

-
rawMessage: 'Only booleans are allowed in a negated boolean, mixed given.'
identifier: booleanNot.exprNotBoolean
count: 1
path: app/cdash/tests/test_managemeasurements.php

-
rawMessage: 'Parameter #1 $array of function array_pop expects array, mixed given.'
identifier: argument.type
Expand All @@ -20364,12 +20274,6 @@ parameters:
count: 2
path: app/cdash/tests/test_managemeasurements.php

-
rawMessage: 'Part $measurement_id (mixed) of encapsed string cannot be cast to string.'
identifier: encapsedStringPart.nonString
count: 3
path: app/cdash/tests/test_managemeasurements.php

-
rawMessage: 'Part $selected_test_name (mixed) of encapsed string cannot be cast to string.'
identifier: encapsedStringPart.nonString
Expand Down Expand Up @@ -22101,12 +22005,6 @@ parameters:
count: 1
path: app/cdash/tests/test_redundanttests.php

-
rawMessage: 'Method RedundantTestsTestCase::testRedundantTests() has no return type specified.'
identifier: missingType.return
count: 1
path: app/cdash/tests/test_redundanttests.php

-
rawMessage: 'Parameter #1 $value of function count expects array|Countable, mixed given.'
identifier: argument.type
Expand Down
4 changes: 0 additions & 4 deletions routes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@
Route::middleware(['auth'])->group(function (): void {
Route::get('/v1/manageSubProject.php', 'SubProjectController@apiManageSubProject');

Route::get('/v1/manageMeasurements.php', 'ManageMeasurementsController@apiGet');
Route::post('/v1/manageMeasurements.php', 'ManageMeasurementsController@apiPost');
Route::delete('/v1/manageMeasurements.php', 'ManageMeasurementsController@apiDelete');

Route::match(['get', 'post'], '/v1/manageOverview.php', 'ProjectOverviewController@apiManageOverview');

Route::middleware(['admin'])->group(function (): void {
Expand Down