diff --git a/application/views/assessment/assessments_view.php b/application/views/assessment/assessments_view.php
index 4b228ac8fc2..fc59079c34f 100644
--- a/application/views/assessment/assessments_view.php
+++ b/application/views/assessment/assessments_view.php
@@ -15,7 +15,7 @@
'
- . gt("If you want to activate it click here:").'
'
+ . gt("If you want to activate it, click here:").'
'
. '
'.gT('Activate assessements').'';
@@ -23,7 +23,7 @@
?>
diff --git a/composer.json b/composer.json
index 2baf68cc39c..bc51acf3434 100644
--- a/composer.json
+++ b/composer.json
@@ -47,8 +47,9 @@
"scripts": {
"test": [
"! find application/ -type f -name '*.php' -print0 | xargs -I {} -0 -P 0 php -l {} | grep -v 'No syntax error'",
+ "! find tests/ -type f -name '*.php' -print0 | xargs -I {} -0 -P 0 php -l {} | grep -v 'No syntax error'",
"./third_party/bin/phpcs --standard=tests/rulesets/phpcs_ruleset.xml application/models/services",
- "./third_party/bin/phpmd application/models/services/ text unusedcode",
+ "./third_party/bin/phpmd application/models/services/ text tests/rulesets/phpmd_ruleset.xml",
"./third_party/bin/psalm application/models/services/"
]
}
diff --git a/tests/bootstrap.php b/tests/bootstrap.php
index 7e89e11c1c8..4d871de94ef 100644
--- a/tests/bootstrap.php
+++ b/tests/bootstrap.php
@@ -216,6 +216,9 @@
}
}
+// NB: This line might be needed if you have PHP in a docker container.
+//$config['components']['db']['connectionString'] = 'mysql:host=localhost;port=3306;dbname=ls4;';
+
// Check that tmp and upload are set to 777 permission (OK on test system).
if (substr(sprintf('%o', fileperms(BASEPATH . '../tmp/')), -4) != '0777') {
die('tmp folder not set to 777');
diff --git a/tests/data/datasets/participantattributes.xml b/tests/data/datasets/participantattributes.xml
deleted file mode 100644
index 7665ca39673..00000000000
--- a/tests/data/datasets/participantattributes.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
diff --git a/tests/unit/controllers/ParticipantActionTest.php b/tests/unit/controllers/ParticipantActionTest.php
index 53b582168e6..8ef2e182151 100644
--- a/tests/unit/controllers/ParticipantActionTest.php
+++ b/tests/unit/controllers/ParticipantActionTest.php
@@ -3,39 +3,12 @@
namespace ls\tests\controllers;
use ls\tests\TestBaseClass;
-use PHPUnit\DbUnit\TestCaseTrait;
/**
* Test the participantsaction controller class.
*/
class ParticipantActionTest extends TestBaseClass
{
- use TestCaseTrait;
-
- /**
- * @return PHPUnit_Extensions_Database_DB_IDatabaseConnection
- */
- public function getConnection()
- {
- $config = include(APPPATH . '/config/config.php');
- $dsn = 'mysql:dbname=limesurvey;host=localhost';
- $user = $config['components']['db']['username'];
- $password = $config['components']['db']['password'];
- $pdo = new \PDO($dsn, $user, $password);
- return $this->createDefaultDBConnection($pdo);
- }
-
- /**
- * @return PHPUnit_Extensions_Database_DataSet_IDataSet
- */
- public function getDataSet()
- {
- if (\PHP_VERSION_ID < 80000) {
- libxml_disable_entity_loader(false);
- }
- return $this->createFlatXMLDataSet(ROOT . '/tests/data/datasets/participantattributes.xml');
- }
-
/**
* @group pp
*/
@@ -49,7 +22,13 @@ public function testUpdateEncryption()
$participantController = new \participantsaction('dummy');
// TODO: Use PHPUnit dataset instead? https://phpunit.de/manual/6.5/en/database.html
- $attribute_id = 10;
+ $attrName = new \ParticipantAttributeName();
+ $attrName->attribute_type = 'TB';
+ $attrName->defaultname = 'encrypted';
+ $attrName->visible = 'TRUE';
+ $attrName->encrypted = 'Y';
+ $attrName->core_attribute = 'N';
+ $this->assertTrue($attrName->save());
$attrName2 = new \ParticipantAttributeName();
$attrName2->attribute_type = 'TB';
@@ -79,7 +58,7 @@ public function testUpdateEncryption()
/** @var array
*/
$extraAttributes = [
- 'ea_' . $attribute_id => 'Some encrypted value',
+ 'ea_' . $attrName->attribute_id => 'Some encrypted value',
'ea_' . $attrName2->attribute_id => 'Some value'
];
@@ -112,7 +91,7 @@ public static function outputError($msg, $code = 0)
$attrValue = \ParticipantAttribute::model()->findByAttributes(
[
'participant_id' => $part->participant_id,
- 'attribute_id' => $attribute_id
+ 'attribute_id' => $attrName->attribute_id
]
);
@@ -131,6 +110,7 @@ public static function outputError($msg, $code = 0)
// Equal, because it is NOT encrypted.
$this->assertEquals('Some value', $attrValue2->value);
+ $this->assertTrue($attrName->delete());
$this->assertTrue($attrName2->delete());
$this->assertTrue($attrValue->delete());
$this->assertTrue($attrValue2->delete());
diff --git a/tests/unit/helpers/RemoteControlTest.php b/tests/unit/helpers/RemoteControlTest.php
index 21cde7ae0fc..9544b3c996b 100644
--- a/tests/unit/helpers/RemoteControlTest.php
+++ b/tests/unit/helpers/RemoteControlTest.php
@@ -333,7 +333,7 @@ public function testImportGroup()
$sessionKey,
self::$surveyId,
$groupData,
- 'lsg',
+ 'lsg'
);
$this->assertIsNumeric($result, '$result = ' . json_encode($result));
@@ -346,5 +346,4 @@ public function testImportGroup()
self::$testSurvey->delete();
self::$testSurvey = null;
}
-
}