Skip to content
This repository was archived by the owner on Sep 10, 2021. It is now read-only.

Commit d4d9233

Browse files
author
Jamie Snape
committed
Update to PHPUnit 4.3 and fix failing tests
1 parent 6a8a9d6 commit d4d9233

File tree

9 files changed

+33
-24
lines changed

9 files changed

+33
-24
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ php:
2626
- 5.6
2727

2828
before_install:
29-
- composer self-update
29+
- composer self-update -n
3030

3131
install:
32-
- composer install
32+
- composer install -n --prefer-dist
3333

3434
before_script:
3535
- cp tests/travis/mysql.ini tests/configs/mysql.ini

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ message(STATUS "Setting up database(s) for testing - done")
8686

8787
include(CTest)
8888
option(MIDAS_RUN_STYLE_TESTS "Run PHP style tests?" ON)
89+
option(MIDAS_RUN_TESTS_WITH_COVERAGE "Run tests with coverage?" OFF)
8990

9091
add_subdirectory(tests)
9192
add_subdirectory(core/tests)

composer.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
"ext-fileinfo": "*",
1616
"ext-gd": "*",
1717
"ext-json": "*",
18-
"francodacosta/phMagick": "0.4.*@dev",
19-
"intervention/image": "~2.0.12",
18+
"francodacosta/phmagick": "0.4.*@dev",
19+
"intervention/image": "~2.0.13",
2020
"leafo/scssphp": "~0.1.1",
2121
"maennchen/zipstream-php": "~0.2.2",
2222
"michelf/php-markdown": "~1.4.1",
@@ -27,10 +27,12 @@
2727
},
2828
"require-dev": {
2929
"ext-curl": "*",
30-
"fabpot/php-cs-fixer": "~0.5.7",
30+
"fabpot/php-cs-fixer": "~1.0",
3131
"phpcheckstyle/phpcheckstyle": "V0.14.1",
32-
"phpunit/dbunit": "~1.3.1",
33-
"phpunit/phpunit": "~3.7.38",
32+
"phpunit/dbunit": "1.3.*@dev",
33+
"phpunit/php-code-coverage": "~2.0.11",
34+
"phpunit/phpcov": "~2.0.1",
35+
"phpunit/phpunit": "~4.3.5",
3436
"satooshi/php-coveralls": "~0.6.1",
3537
"sensiolabs/security-checker": "~2.0.0"
3638
},

core/configs/application.ini

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ application.description =
99
application.lang = en
1010
; session lifetime (minute)
1111
session.lifetime = 20
12-
; path to md5sum
13-
md5sum.path =
1412
; default assetstore
1513
defaultassetstore.id =
1614
; default timezone

core/controllers/UploadController.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class UploadController extends AppController
2323
{
2424
public $_components = array('Upload');
2525
public $_forms = array('Upload');
26-
public $_models = array('Assetstore', 'Folder', 'Folderpolicygroup', 'Folderpolicyuser', 'Item', 'License');
26+
public $_models = array('Assetstore', 'Folder', 'Folderpolicygroup', 'Folderpolicyuser', 'Item', 'License', 'Setting');
2727

2828
/** Init controller */
2929
public function init()
@@ -48,9 +48,7 @@ public function init()
4848
} else {
4949
$assetstoreDao = $assetstores[0];
5050
}
51-
$config = Zend_Registry::get('configGlobal');
52-
$config->defaultassetstore->id = $assetstoreDao->getKey();
53-
Zend_Registry::set('configGlobal', $config);
51+
$this->Setting->setConfig('default_assetstore', $assetstoreDao->getKey());
5452
}
5553
}
5654

core/controllers/components/UtilityComponent.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,11 @@ public static function createInitFile($path, $data)
213213
public static function md5file($filename)
214214
{
215215
// If we have md5 sum
216-
if (Zend_Registry::get('configGlobal')->md5sum->path) {
217-
$result = exec(Zend_Registry::get('configGlobal')->md5sum->path.' '.$filename);
216+
$settingModel = MidasLoader::loadModel('Setting');
217+
$md5sumCommand = $settingModel->getValueByName('md5sum_command');
218+
219+
if (!empty($md5sumCommand)) {
220+
$result = exec($md5sumCommand.' '.$filename);
218221
$resultarray = explode(' ', $result);
219222

220223
return $resultarray[0];

modules/javauploaddownload/controllers/UploadController.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
class Javauploaddownload_UploadController extends Javauploaddownload_AppController
2323
{
2424
public $_components = array('Httpupload', 'Upload');
25-
public $_models = array('Assetstore', 'Folder', 'Item', 'License');
25+
public $_models = array('Assetstore', 'Folder', 'Item', 'License', 'Setting');
2626

2727
private function _is_https()
2828
{
@@ -45,10 +45,7 @@ public function init()
4545
} else {
4646
$assetstoreDao = $assetstores[0];
4747
}
48-
49-
$config = Zend_Registry::get('configGlobal');
50-
$config->defaultassetstore->id = $assetstoreDao->getKey();
51-
Zend_Registry::set('configGlobal', $config);
48+
$this->Setting->setConfig('default_assetstore', $assetstoreDao->getKey());
5249
}
5350
}
5451

phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/3.7/phpunit.xsd"
3+
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.3/phpunit.xsd"
44
bootstrap="tests/TestsBootstrap.php"
55
colors="true">
66
<testsuites>

tests/CMakeLists.txt

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@
1717
# limitations under the License.
1818
#=============================================================================
1919

20+
if(MIDAS_RUN_TESTS_WITH_COVERAGE)
21+
if(EXISTS ${CMAKE_BINARY_DIR}/cov)
22+
file(REMOVE_RECURSE ${CMAKE_BINARY_DIR}/cov)
23+
endif()
24+
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/cov)
25+
endif()
26+
2027
macro(to_titlecase Arg Result)
2128
string(SUBSTRING ${Arg} 0 1 ArgHead)
2229
string(TOUPPER ${ArgHead} ArgHead)
@@ -32,9 +39,10 @@ endfunction()
3239

3340
function(add_midas_mysql_test TestName TestFile)
3441
if(EXISTS ${CMAKE_SOURCE_DIR}/tests/configs/mysql.ini)
42+
set(TestParams --debug --bootstrap ${CMAKE_SOURCE_DIR}/tests/TestsBootstrap.php)
3543
add_test(
3644
MySQL${TestName}
37-
${PHP} ${CMAKE_SOURCE_DIR}/tests/PHPUnitMySQL.php --debug --bootstrap ${CMAKE_SOURCE_DIR}/tests/TestsBootstrap.php ${CMAKE_CURRENT_SOURCE_DIR}/${TestFile}
45+
${PHP} ${CMAKE_SOURCE_DIR}/tests/PHPUnitMySQL.php ${TestParams} ${CMAKE_CURRENT_SOURCE_DIR}/${TestFile}
3846
)
3947
set_tests_properties(
4048
MySQL${TestName} PROPERTIES
@@ -46,9 +54,10 @@ endfunction()
4654

4755
function(add_midas_pgsql_test TestName TestFile)
4856
if(EXISTS ${CMAKE_SOURCE_DIR}/tests/configs/pgsql.ini)
57+
set(TestParams --debug --bootstrap ${CMAKE_SOURCE_DIR}/tests/TestsBootstrap.php)
4958
add_test(
5059
PgSQL${TestName}
51-
${PHP} ${CMAKE_SOURCE_DIR}/tests/PHPUnitPgSQL.php --debug --bootstrap ${CMAKE_SOURCE_DIR}/tests/TestsBootstrap.php ${CMAKE_CURRENT_SOURCE_DIR}/${TestFile}
60+
${PHP} ${CMAKE_SOURCE_DIR}/tests/PHPUnitPgSQL.php ${TestParams} ${CMAKE_CURRENT_SOURCE_DIR}/${TestFile}
5261
)
5362
set_tests_properties(
5463
PgSQL${TestName} PROPERTIES
@@ -60,9 +69,10 @@ endfunction()
6069

6170
function(add_midas_sqlite_test TestName TestFile)
6271
if(EXISTS ${CMAKE_SOURCE_DIR}/tests/configs/sqlite.ini)
72+
set(TestParams --debug --bootstrap ${CMAKE_SOURCE_DIR}/tests/TestsBootstrap.php)
6373
add_test(
6474
SQLite${TestName}
65-
${PHP} ${CMAKE_SOURCE_DIR}/tests/PHPUnitSQLite.php --debug --bootstrap ${CMAKE_SOURCE_DIR}/tests/TestsBootstrap.php ${CMAKE_CURRENT_SOURCE_DIR}/${TestFile}
75+
${PHP} ${CMAKE_SOURCE_DIR}/tests/PHPUnitSQLite.php ${TestParams} ${CMAKE_CURRENT_SOURCE_DIR}/${TestFile}
6676
)
6777
set_tests_properties(
6878
SQLite${TestName} PROPERTIES

0 commit comments

Comments
 (0)