Skip to content

Commit

Permalink
php unit bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
b23prodtm committed Nov 25, 2018
1 parent eaf8a7a commit 817de23
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/tags
*.mo
/bin/composer.phar
/app/Config/identities.sql
/app/Config/identities.sql*

# IDE and editor specific files #
#################################
Expand Down
2 changes: 1 addition & 1 deletion .travis/TravisCI-OSX-PHP
4 changes: 2 additions & 2 deletions Scripts/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ source $hash
echo -e "${nc}Password ${green}$GET_HASH_PASSWORD${nc}"
#; Install PHPUnit, performs unit tests
#; The website must pass health checks in order to be deployed
phpunit="app/vendor/bin/phpunit"
phpunit="./app/vendor/bin/phpunit"
if [ ! -f $phpunit ]; then
if [ ! -f bin/composer.phar ]; then
source ./Scripts/composer.sh
Expand All @@ -33,4 +33,4 @@ else
echo -e "PHPUnit ${green}[OK]${nc}"
fi
echo `$phpunit --version`
source ./Scripts/config_app_database.sh
source ./Scripts/config_app_database.sh
11 changes: 6 additions & 5 deletions app/Config/boot_profile.cms.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@
CakePlugin::load(array('Markdown' => array('bootstrap' => true)));

/*var_dump(App::path('Cms'));*/
/* -- PHP AUTOLOAD */
// Load Composer autoload.
require APP . 'Vendor/autoload.php';// Remove and re-prepend CakePHP's autoloader as Composer thinks it is the
// most important.
// See: http://goo.gl/kKVJO7
/* -- PHP AUTOLOAD
Load Composer autoload.*/
require APP . 'Vendor' . DS . 'autoload.php';
/* Remove and re-prepend CakePHP's autoloader as Composer thinks it is the
most important.
See: http://goo.gl/kKVJO7 */
spl_autoload_unregister(array('App', 'load'));
spl_autoload_register(array('App', 'load'), true, true);
/* PHP AUTOLOAD (app/Vendor/autoload.php installed from composer)
Expand Down
2 changes: 1 addition & 1 deletion app/Config/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,4 @@
));

/** PHP autoloader shall detect applcation plugins from this profile */
include_once APP . DS . 'config' . DS . 'boot_profile.cms.php';
include_once APP . 'config' . DS . 'boot_profile.cms.php';
6 changes: 3 additions & 3 deletions app/Config/identities.sql.old
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@

create database if not exists phpcms;
use mysql;
create user if not exists 'test'@'localhost';
alter user 'test'@'localhost' identified by 'mypassword';
create user if not exists 'test'@'127.0.0.1';
alter user 'test'@'127.0.0.1' identified by 'mypassword';
select * from user where user = 'test';
grant all on phpcms.* to 'test'@'localhost';
grant all on phpcms.* to 'test'@'127.0.0.1';

create database if not exists cakephp_test;
use mysql;
Expand Down
2 changes: 1 addition & 1 deletion bootstrap_phpunit.php → app/bootstrap_phpunit.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
}

/** PHP autoloader shall detect applcation plugins from this profile */
include_once APP . DS . 'Config' . DS 'boot_profile.cms.php';
include_once APP . 'Config' . DS 'boot_profile.cms.php';

require_once CAKE . 'TestSuite' . DS . 'CakeTestSuiteDispatcher.php';
require_once CAKE . 'TestSuite' . DS . 'CakeTestSuiteCommand.php';
2 changes: 1 addition & 1 deletion app/phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
beStrictAboutChangesToGlobalState="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTestsThatDoNotTestAnything="true"
bootstrap="vendor/autoload.php"
bootstrap="bootstrap_phpunit.php"
colors="true"
columns="max"
convertErrorsToExceptions="true"
Expand Down
1 change: 1 addition & 0 deletions app/webroot/test.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,6 @@
require_once CAKE . 'TestSuite' . DS . 'CakeTestSuiteDispatcher.php';

App::uses('Index','Cms');
App::uses('SQL', 'Cms')
$r = new Index(null, WWW_ROOT . 'test.php', false, WWW_ROOT . 'php_cms' . DS, DS, false);
CakeTestSuiteDispatcher::run();
4 changes: 2 additions & 2 deletions test-cake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ while [[ "$#" > 0 ]]; do case $1 in
export TRAVIS_OS_NAME="osx"
export TRAVIS_PHP_VERSION=$(php -v | grep -E "[5-7]\.\\d+\.\\d+" | cut -d " " -f 2 | cut -c 1-3
)
# remote servers CI doesn't need a root password import (-i) but the socket => -y
# remote servers CI doesn't need a root password import (-i) but the socket => -y
source configure.sh "-c" "-h" "-p" "pass" "-s" "word" "--mig-database" "-i"
source .travis/configure.sh;;
--cov )
export COVERITY_SCAN_BRANCH=1;;
-[hH]*|--help )
echo "./test-cake.sh [-p, --sql-password <password>] [-t, --travis [--cov]]
-p, --sql-password SQL_PASSWORD
-t Travis CI Test Workflow
-t Travis CI Local Test Workflow
--cov Coverity Scan tests
"
exit 0;;
Expand Down

0 comments on commit 817de23

Please sign in to comment.