From 8b407927b3befa091e9b7bf45ef0cfc307166cb4 Mon Sep 17 00:00:00 2001 From: Olle Haerstedt Date: Wed, 22 Jan 2020 10:50:22 +0100 Subject: [PATCH] Dev: Apply namespaces to remote control tests --- tests/bootstrap.php | 2 ++ tests/helpers/remotecontrol/BaseTest.php | 8 ++++---- .../remotecontrol/CPDImportParticpantsTest.php | 14 +++++++------- tests/helpers/remotecontrol/GetSessionKeyTest.php | 2 +- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 2cd079f2a67..8681b83afa1 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -238,12 +238,14 @@ throw new ErrorException($msg, 0, $no, $file, $line); }, E_ERROR & E_WARNING & E_PARSE & E_NOTICE); +// TODO: Edit composer.json to add autoloading with proper namespaces. require_once(__DIR__ . '/LimeSurveyWebDriver.php'); require_once(__DIR__ . '/TestHelper.php'); require_once(__DIR__ . '/TestBaseClass.php'); require_once(__DIR__ . '/TestBaseClassWeb.php'); require_once(__DIR__ . '/TestBaseClassView.php'); require_once(__DIR__ . '/DummyController.php'); +require_once __DIR__ . '/helpers/remotecontrol/BaseTest.php'; define('PHP_ENV', 'test'); diff --git a/tests/helpers/remotecontrol/BaseTest.php b/tests/helpers/remotecontrol/BaseTest.php index 7139caaa56e..dee4cd122b1 100644 --- a/tests/helpers/remotecontrol/BaseTest.php +++ b/tests/helpers/remotecontrol/BaseTest.php @@ -1,6 +1,6 @@ importAll(); - Yii::import('application.helpers.remotecontrol.remotecontrol_handle', true); + \Yii::import('application.helpers.remotecontrol.remotecontrol_handle', true); - $user = User::model()->findByPk(1); + $user = \User::model()->findByPk(1); if (!$user) { $this->fail('Admin User missing'); } $this->user = $user; - $this->handler = new remotecontrol_handle(new AdminController('dummyid')); + $this->handler = new \remotecontrol_handle(new \AdminController('dummyid')); } /** diff --git a/tests/helpers/remotecontrol/CPDImportParticpantsTest.php b/tests/helpers/remotecontrol/CPDImportParticpantsTest.php index 9bdb182e2c9..528345db131 100644 --- a/tests/helpers/remotecontrol/CPDImportParticpantsTest.php +++ b/tests/helpers/remotecontrol/CPDImportParticpantsTest.php @@ -1,17 +1,17 @@ db->createCommand()->truncateTable('{{participants}}'); - Yii::app()->db->createCommand()->truncateTable('{{participant_attribute}}'); - Yii::app()->db->createCommand()->truncateTable('{{participant_attribute_names}}'); - Yii::app()->db->createCommand()->truncateTable('{{participant_attribute_names_lang}}'); - Yii::app()->db->createCommand()->truncateTable('{{participant_attribute_values}}'); - Yii::app()->db->createCommand()->truncateTable('{{participant_shares}}'); + \Yii::app()->db->createCommand()->truncateTable('{{participants}}'); + \Yii::app()->db->createCommand()->truncateTable('{{participant_attribute}}'); + \Yii::app()->db->createCommand()->truncateTable('{{participant_attribute_names}}'); + \Yii::app()->db->createCommand()->truncateTable('{{participant_attribute_names_lang}}'); + \Yii::app()->db->createCommand()->truncateTable('{{participant_attribute_values}}'); + \Yii::app()->db->createCommand()->truncateTable('{{participant_shares}}'); parent::setUp(); } diff --git a/tests/helpers/remotecontrol/GetSessionKeyTest.php b/tests/helpers/remotecontrol/GetSessionKeyTest.php index fa3ebb80bb2..dbfab77d878 100644 --- a/tests/helpers/remotecontrol/GetSessionKeyTest.php +++ b/tests/helpers/remotecontrol/GetSessionKeyTest.php @@ -1,6 +1,6 @@