assertTrue($response->wasSuccessful(), $response->generatePHPUnitMessage()); $this->assertIsBool($response->getResult()); } public function testErrorReportingToggle(): void { // Get the starting value $before = Request::makeRequest('admin/system/error_reporting_enabled')->getResult(); $this->assertIsBool($before); // Toggle the option $response = Request::makeRequest('admin/system/toggle_error_reporting'); $this->assertTrue($response->wasSuccessful(), $response->generatePHPUnitMessage()); $this->assertTrue($response->getResult()); // Check that it was correctly switched $after = Request::makeRequest('admin/system/error_reporting_enabled')->getResult(); $this->assertIsBool($after); $this->assertNotEquals($after, $before); // Ensure we don't leave error reporting on (it shouldn't report anyways, but this is best practice) if ($after) { $response = Request::makeRequest('admin/system/toggle_error_reporting'); $this->assertTrue($response->wasSuccessful(), $response->generatePHPUnitMessage()); $this->assertTrue($response->getResult()); } } }