Skip to content

Commit

Permalink
Test: Refactor test folder
Browse files Browse the repository at this point in the history
The new E2E CI server is missing project & media files needed to run tests.

-Move test/php/common/ to /test/common/ so both PHP and E2E tests can access them
-Update rsync for E2E tests
-Remove deprecated simpletest lines and protractorConf.*.js files
  • Loading branch information
darcywong00 committed Feb 17, 2017
1 parent d3042db commit e006476
Show file tree
Hide file tree
Showing 20 changed files with 42 additions and 173 deletions.
6 changes: 3 additions & 3 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -876,13 +876,13 @@ gulp.task('build-upload', function (cb) {

// For E2E tests, upload test dir to destination
if (params.dest.includes('e2etest')) {
options.src = 'test/app/';
options.dest = path.join(params.dest, '/test/app');
options.src = 'test/';
options.dest = path.join(params.dest, '/test');

execute(
'rsync -progzlt --chmod=Dug=rwx,Fug=rw,o-rwx ' +
'--delete-during --stats --rsync-path="sudo rsync" <%= rsh %> ' +
'<%= src %> <%= dest %>',
'<%= src %> <%= dest %> --exclude php',
options,
cb
);
Expand Down
73 changes: 0 additions & 73 deletions test/app/protractorConf.languageforge.js

This file was deleted.

58 changes: 0 additions & 58 deletions test/app/protractorConf.scriptureforge.js

This file was deleted.

12 changes: 6 additions & 6 deletions test/app/setupTestEnvironment.php
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@

// put a copy of the test file in tmp
$tmpFilePath = sys_get_temp_dir() . "/CopyOf$fileName";
copy(TestPath . "php/common/$fileName", $tmpFilePath);
copy(TestPath . "common/$fileName", $tmpFilePath);

$response = LexUploadCommands::uploadAudioFile($testProjectId, 'audio', $tmpFilePath);

Expand All @@ -294,7 +294,7 @@

// put a copy of the test file in tmp
$tmpFilePath = sys_get_temp_dir() . "/CopyOf$fileName";
copy(TestPath . "php/common/$fileName", $tmpFilePath);
copy(TestPath . "common/$fileName", $tmpFilePath);

$response = LexUploadCommands::uploadImageFile($testProjectId, 'sense-image', $tmpFilePath);

Expand Down Expand Up @@ -328,20 +328,20 @@
// put mock uploaded zip import (jpg file)
$fileName = $constants['testMockJpgImportFile']['name'];
$tmpFilePath = sys_get_temp_dir() . DIRECTORY_SEPARATOR . $fileName;
copy(TestPath . "php/common/$fileName", $tmpFilePath);
copy(TestPath . "common/$fileName", $tmpFilePath);

// put mock uploaded zip import (zip file)
$fileName = $constants['testMockZipImportFile']['name'];
$tmpFilePath = sys_get_temp_dir() . DIRECTORY_SEPARATOR . $fileName;
copy(TestPath . "php/common/$fileName", $tmpFilePath);
copy(TestPath . "common/$fileName", $tmpFilePath);

// put mock uploaded audio (png file)
$fileName = $constants['testMockPngUploadFile']['name'];
$tmpFilePath = sys_get_temp_dir() . DIRECTORY_SEPARATOR . $fileName;
copy(TestPath . "php/common/$fileName", $tmpFilePath);
copy(TestPath . "common/$fileName", $tmpFilePath);

// put mock uploaded audio (mp3 file)
$fileName = $constants['testMockMp3UploadFile']['name'];
$tmpFilePath = sys_get_temp_dir() . DIRECTORY_SEPARATOR . $fileName;
copy(TestPath . "php/common/$fileName", $tmpFilePath);
copy(TestPath . "common/$fileName", $tmpFilePath);
}
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions test/php/TestConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
define('TestMode', true);

define('TestPath', $rootPath . 'test/');
define('TestCommonPath', $rootPath . 'test/common/');
define('TestPhpPath', $rootPath . 'test/php/');
define('TestLibPath', $rootPath . 'test/lib/');
define('SimpleTestPath', $rootPath . 'src/vendor/simpletest/simpletest/');
define('SourcePath', $rootPath . 'src/');

define('SF_DATABASE', 'scriptureforge_test');
Expand All @@ -34,4 +34,4 @@
global $WEBSITE;
$WEBSITE = Website::get('dev.scriptureforge.org');

require_once TestPhpPath . 'common/MongoTestEnvironment.php';
require_once TestCommonPath . 'MongoTestEnvironment.php';
10 changes: 5 additions & 5 deletions test/php/model/languageforge/lexicon/LiftImportZipTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function tearDown()

public function testLiftImportMerge_ZipFile_CorrectValues()
{
$zipFilePath = self::$environ->copyTestUploadFile(TestPhpPath . 'common/TestLexProject.zip');
$zipFilePath = self::$environ->copyTestUploadFile(TestCommonPath . 'TestLexProject.zip');
$project = self::$environ->createProject(SF_TESTPROJECT, SF_TESTPROJECTCODE);

$this->assertArrayHasKey('en', $project->inputSystems);
Expand Down Expand Up @@ -80,7 +80,7 @@ public function testLiftImportMerge_ZipFile_CorrectValues()
*/
public function testLiftImportMerge_ZipFileWrongFormat_Exception()
{
copy(TestPhpPath . 'common/TestLexProject.zip', sys_get_temp_dir() . '/TestLexProject.tar.gz');
copy(TestCommonPath . 'TestLexProject.zip', sys_get_temp_dir() . '/TestLexProject.tar.gz');
$zipFilePath = self::$environ->copyTestUploadFile(sys_get_temp_dir() . '/TestLexProject.tar.gz');
unlink(sys_get_temp_dir() . '/TestLexProject.tar.gz');
$project = self::$environ->createProject(SF_TESTPROJECT, SF_TESTPROJECTCODE);
Expand All @@ -101,7 +101,7 @@ public function testLiftImportMerge_ZipFileWrongFormat_RestoreErrorDisplay()

public function testLiftImportMerge_ZipFileWithDir_CorrectValues()
{
$zipFilePath = self::$environ->copyTestUploadFile(TestPhpPath . 'common/TestLexProjectWithDir.zip');
$zipFilePath = self::$environ->copyTestUploadFile(TestCommonPath . 'TestLexProjectWithDir.zip');
$project = self::$environ->createProject(SF_TESTPROJECT, SF_TESTPROJECTCODE);

$importer = LiftImport::get()->importZip($zipFilePath, $project);
Expand Down Expand Up @@ -139,7 +139,7 @@ public function testLiftImportMerge_ZipFileWithDir_CorrectValues()
*/
public function testLiftImportMerge_ZipFileNoLift_Exception()
{
$zipFilePath = self::$environ->copyTestUploadFile(TestPhpPath . 'common/TestLexNoProject.zip');
$zipFilePath = self::$environ->copyTestUploadFile(TestCommonPath . 'TestLexNoProject.zip');
$project = self::$environ->createProject(SF_TESTPROJECT, SF_TESTPROJECTCODE);
self::$environ->inhibitErrorDisplay();

Expand All @@ -158,7 +158,7 @@ public function testLiftImportMerge_ZipFileNoLift_RestoreErrorDisplay()

public function testLiftImportMerge_ZipFile2LiftAndOddFolder_Error()
{
$zipFilePath = self::$environ->copyTestUploadFile(TestPhpPath . 'common/TestLex2ProjectsOddFolder.zip');
$zipFilePath = self::$environ->copyTestUploadFile(TestCommonPath . 'TestLex2ProjectsOddFolder.zip');
$project = self::$environ->createProject(SF_TESTPROJECT, SF_TESTPROJECTCODE);

$importer = LiftImport::get()->importZip($zipFilePath, $project);
Expand Down
Loading

0 comments on commit e006476

Please sign in to comment.