AspireCloud/tests/Feature/API/WpOrg/ServeHappyControllerTest.php
Chuck Adams e3bb766b61
minor tweaks ahead of upgrades (#198)
* zap: drop redundant caching middleware

* fix: make PluginFactory generate proper versions format

* refactor: use $this->get directly instead of makeApiRequest

* ci: pin action versions in dependency-review action (irony)

Admittedly if actions/checkout is ever compromised, it's game over anyway.

* ci: make OSSF scorecard action manual-only

* ci: pin all runners onto ubuntu-24.04

* test: inline the sole use of assertWpPluginAPIStructure

* meta: add github-actions to dependabot

* build: composer upgrade and bump
2025-03-17 15:02:02 -06:00

37 lines
1.2 KiB
PHP

<?php
it('serves happy', function () {
$response = $this->get('/core/serve-happy/1.0?php_version=8.3');
$response
->assertStatus(200)
->assertJson([
"recommended_version" => "7.4",
"minimum_version" => "7.2.24",
"is_supported" => true,
"is_secure" => true,
"is_acceptable" => true,
]);
});
it('shows false for insecure versions', function () {
$response = $this->get('/core/serve-happy/1.0?php_version=5.3');
$response
->assertStatus(200)
->assertJson([
"recommended_version" => "7.4",
"minimum_version" => "7.2.24",
"is_supported" => false,
"is_secure" => false,
"is_acceptable" => false,
]);
});
it('requires php_version param', function () {
// upstream throws 400 and returns a json error, but wp only checks for a 200 status, so these are fine
$response = $this->get('/core/serve-happy/1.0');
$response->assertStatus(302); // laravel's validation failure behavior for non-json requests
$response = $this->get('/core/serve-happy/1.0', ['Accept' => 'application/json']);
$response->assertStatus(422);
});