diff --git a/config/bootstrap.php b/config/bootstrap.php index 828d1f58..2ef72f7c 100644 --- a/config/bootstrap.php +++ b/config/bootstrap.php @@ -37,6 +37,7 @@ use Cake\Datasource\ConnectionManager; use Cake\Error\ErrorTrap; use Cake\Error\ExceptionTrap; +use Cake\Http\ServerRequest; use Cake\Log\Log; use Cake\Mailer\Mailer; use Cake\Mailer\TransportFactory; @@ -162,3 +163,11 @@ Security::setSalt((string)Configure::consume('Security.salt')); \Sentry\init(Configure::consume('Sentry')); + +// Default value as inertia plugin only sets this when inertia is used, +ServerRequest::addDetector('inertia', function () { + return false; +}); +ServerRequest::addDetector('inertia-partial-data', function () { + return false; +}); diff --git a/src/Controller/SubtasksController.php b/src/Controller/SubtasksController.php index 502872f4..88bb5850 100644 --- a/src/Controller/SubtasksController.php +++ b/src/Controller/SubtasksController.php @@ -4,6 +4,8 @@ namespace App\Controller; use App\Model\Entity\Task; +use App\Model\Table\SubtasksTable; +use App\Model\Table\TasksTable; use Cake\View\JsonView; use InvalidArgumentException; @@ -15,6 +17,9 @@ */ class SubtasksController extends AppController { + public TasksTable $Tasks; + public SubtasksTable $Subtasks; + public function initialize(): void { parent::initialize(); diff --git a/src/Service/CalendarServiceProvider.php b/src/Service/CalendarServiceProvider.php index 0349b298..6008e221 100644 --- a/src/Service/CalendarServiceProvider.php +++ b/src/Service/CalendarServiceProvider.php @@ -25,6 +25,7 @@ public function services(ContainerInterface $container): void { $container->add(GoogleClient::class, function () { $file = file_get_contents(ROOT . '/config/google-auth.json'); + assert($file !== false, 'Could not read config/google-auth.json'); $config = json_decode($file, true); $client = new GoogleClient(); diff --git a/tests/TestCase/Controller/GoogleOauthControllerTest.php b/tests/TestCase/Controller/GoogleOauthControllerTest.php index bae03973..90da6f70 100644 --- a/tests/TestCase/Controller/GoogleOauthControllerTest.php +++ b/tests/TestCase/Controller/GoogleOauthControllerTest.php @@ -4,6 +4,7 @@ namespace App\Test\TestCase\Controller; use App\Controller\GoogleOauthController; +use App\Model\Table\CalendarProvidersTable; use App\Test\TestCase\FactoryTrait; use Cake\TestSuite\IntegrationTestTrait; use Cake\TestSuite\TestCase; @@ -18,6 +19,8 @@ class GoogleOauthControllerTest extends TestCase use FactoryTrait; use IntegrationTestTrait; + protected CalendarProvidersTable $CalendarProviders; + /** * @var array */ diff --git a/tests/TestCase/Controller/ProjectsControllerTest.php b/tests/TestCase/Controller/ProjectsControllerTest.php index 34bc672c..b79488eb 100644 --- a/tests/TestCase/Controller/ProjectsControllerTest.php +++ b/tests/TestCase/Controller/ProjectsControllerTest.php @@ -3,6 +3,7 @@ namespace App\Test\TestCase\Controller; +use App\Model\Table\ProjectsTable; use App\Test\TestCase\FactoryTrait; use Cake\TestSuite\IntegrationTestTrait; use Cake\TestSuite\TestCase; @@ -17,6 +18,8 @@ class ProjectsControllerTest extends TestCase use FactoryTrait; use IntegrationTestTrait; + public ProjectsTable $Projects; + /** * Fixtures * diff --git a/tests/TestCase/Controller/UsersControllerTest.php b/tests/TestCase/Controller/UsersControllerTest.php index b1686b43..4850f8d6 100644 --- a/tests/TestCase/Controller/UsersControllerTest.php +++ b/tests/TestCase/Controller/UsersControllerTest.php @@ -3,9 +3,9 @@ namespace App\Test\TestCase\Controller; +use App\Model\Table\UsersTable; use App\Test\TestCase\FactoryTrait; use Cake\I18n\FrozenTime; -use Cake\ORM\TableRegistry; use Cake\TestSuite\EmailTrait; use Cake\TestSuite\IntegrationTestTrait; use Cake\TestSuite\TestCase; @@ -21,6 +21,8 @@ class UsersControllerTest extends TestCase use EmailTrait; use IntegrationTestTrait; + public UsersTable $Users; + /** * Fixtures * @@ -34,7 +36,7 @@ class UsersControllerTest extends TestCase public function setUp(): void { parent::setUp(); - $this->Users = TableRegistry::get('Users'); + $this->Users = $this->fetchTable('Users'); } public function testLogin()