Skip to content

Commit

Permalink
Dev: Apply namespaces to remote control tests
Browse files Browse the repository at this point in the history
  • Loading branch information
olleharstedt committed Jan 22, 2020
1 parent ea95b77 commit 8b40792
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
2 changes: 2 additions & 0 deletions tests/bootstrap.php
Expand Up @@ -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');

Expand Down
8 changes: 4 additions & 4 deletions tests/helpers/remotecontrol/BaseTest.php
@@ -1,6 +1,6 @@
<?php

use \ls\tests\TestHelper;
namespace ls\tests;

abstract class BaseTest extends TestHelper
{
Expand All @@ -17,15 +17,15 @@ abstract class BaseTest extends TestHelper
protected function setUp()
{
$this->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'));
}

/**
Expand Down
14 changes: 7 additions & 7 deletions tests/helpers/remotecontrol/CPDImportParticpantsTest.php
@@ -1,17 +1,17 @@
<?php

require_once __DIR__ . DIRECTORY_SEPARATOR . 'BaseTest.php';
namespace ls\tests;

class CPDImportParticpantsTest extends BaseTest
{
public function setUp()
{
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}}');
\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();
}

Expand Down
2 changes: 1 addition & 1 deletion tests/helpers/remotecontrol/GetSessionKeyTest.php
@@ -1,6 +1,6 @@
<?php

require_once __DIR__ . DIRECTORY_SEPARATOR . 'BaseTest.php';
namespace ls\tests;

class GetSessionKeyTest extends BaseTest
{
Expand Down

0 comments on commit 8b40792

Please sign in to comment.