mirror of
https://github.com/salesagility/SuiteCRM.git
synced 2025-03-14 21:42:52 +00:00
Codeception: Moved old tests to CodeCeption
Moving old bootstrap to codeceptions bootstrap
This commit is contained in:
parent
f68069f88f
commit
9e32a36849
153 changed files with 228 additions and 146 deletions
.gitignorecodeception.ymlcomposer.jsontestinstall.php
tests
_bootstrap.php
_data
_output
_support
acceptance.suite.ymlacceptance
bootstrap.phpfunctional.suite.ymlfunctional
phpunit.xml.distruntests.shtestinstall.phpunit.suite.ymlunit
_bootstrap.phpconfigTest.php
include
MVC
Controller
SugarApplicationTest.phpSugarModuleTest.phpView
SugarViewTest.phpViewFactoryTest.php
views
view.ajaxTest.phpview.ajaxuiTest.phpview.classicTest.phpview.detailTest.phpview.editTest.phpview.favoritesTest.phpview.htmlTest.phpview.importvcardTest.phpview.importvcardsaveTest.phpview.jsonTest.phpview.listTest.phpview.metadataTest.phpview.modulelistmenuTest.phpview.multieditTest.phpview.noaccessTest.phpview.popupTest.phpview.quickTest.phpview.quickcreateTest.phpview.quickeditTest.phpview.serializedTest.phpview.sugarpdfTest.phpview.vcardTest.phpview.xmlTest.php
utils
modules
ACLActions
ACLRoles
AM_ProjectTemplates
AM_TaskTemplates
AOD_Index
AOD_IndexEvent
AOK_KnowledgeBase
AOK_Knowledge_Base_Categories
AOP_Case_Events
AOP_Case_Updates
AOR_Charts
AOR_Conditions
AOR_Fields
AOR_Reports
AOR_Scheduled_Reports
AOS_Contracts
AOS_Invoices
AOS_Line_Item_Groups
AOS_PDF_Templates
AOS_Product_Categories
AOS_Products
AOS_Products_Quotes
AOS_Quotes
AOW_Actions
AOW_Conditions
AOW_Processed
AOW_WorkFlow
Accounts
Administration
Alerts
Audit
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -88,4 +88,5 @@ themes/SuiteP/css/*.css
|
|||
!themes/SuiteP/css/deprecated.css
|
||||
!themes/SuiteP/css/fonts.css
|
||||
!themes/SuiteP/css/footable.core.css
|
||||
!themes/SuiteP/css/style.css
|
||||
!themes/SuiteP/css/style.css
|
||||
tests/_output/*
|
14
codeception.yml
Normal file
14
codeception.yml
Normal file
|
@ -0,0 +1,14 @@
|
|||
actor: Tester
|
||||
paths:
|
||||
tests: tests
|
||||
log: tests/_output
|
||||
data: tests/_data
|
||||
support: tests/_support
|
||||
envs: tests/_envs
|
||||
settings:
|
||||
bootstrap: _bootstrap.php
|
||||
colors: true
|
||||
memory_limit: 1024M
|
||||
extensions:
|
||||
enabled:
|
||||
- Codeception\Extension\RunFailed
|
|
@ -12,7 +12,6 @@
|
|||
},
|
||||
"require-dev": {
|
||||
"leafo/scssphp": "dev-master",
|
||||
"phpunit/phpunit": "^3.7",
|
||||
"mikey179/vfsStream": "1.4.*",
|
||||
"codeception/codeception": "^2.2"
|
||||
},
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
<?php
|
||||
/* DEFINE SOME VARIABLES FOR INSTALLER */
|
||||
$_SERVER['HTTP_HOST'] = 'localhost';
|
||||
$_SERVER['REQUEST_URI'] = 'install.php';
|
||||
$_SERVER["SERVER_SOFTWARE"] = 'Apache';
|
||||
$_SERVER['SERVER_NAME'] = 'localhost';
|
||||
$_SERVER['SERVER_PORT'] = '80';
|
||||
$_REQUEST['goto'] = 'SilentInstall';
|
||||
$_REQUEST['cli'] = true;
|
||||
// this will fix warning in modules/Users/Save.php:295 during installation
|
||||
$_POST['email_reminder_checked'] = false;
|
||||
try {
|
||||
/*
|
||||
* Do some cleanup so we can relaunch installer over and over again (we can get rid of this)
|
||||
*/
|
||||
if(is_file("config.php")) {
|
||||
unlink("config.php");
|
||||
}
|
||||
ob_start();
|
||||
require_once 'install.php';
|
||||
ob_end_clean();
|
||||
} catch(\Exception $e) {
|
||||
echo "\nINSTALLATION FAILED! file: " . $e->getFile() . " - line: " . $e->getLine()
|
||||
. "\n" . $e->getMessage()
|
||||
. "\n" . str_repeat("-", 120)
|
||||
. "\n" . print_r($e->getTrace(), true)
|
||||
. "\n" . str_repeat("-", 120)
|
||||
. "\n";
|
||||
}
|
60
tests/_bootstrap.php
Normal file
60
tests/_bootstrap.php
Normal file
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
// This is global bootstrap for autoloading
|
||||
// get silent config
|
||||
$file_config = file_get_contents(__DIR__.'/travis_config_si.php');
|
||||
$write_config = file_put_contents(__DIR__.'/../config_si.php');
|
||||
|
||||
if($write_config === false) {
|
||||
throw new Exception('Unable to copy silent config file');
|
||||
}
|
||||
|
||||
// Install db
|
||||
/* DEFINE SOME VARIABLES FOR INSTALLER */
|
||||
$_SERVER['HTTP_HOST'] = 'localhost';
|
||||
$_SERVER['REQUEST_URI'] = 'install.php';
|
||||
$_SERVER["SERVER_SOFTWARE"] = 'Apache';
|
||||
$_SERVER['SERVER_NAME'] = 'localhost';
|
||||
$_SERVER['SERVER_PORT'] = '80';
|
||||
$_REQUEST['goto'] = 'SilentInstall';
|
||||
$_REQUEST['cli'] = true;
|
||||
// this will fix warning in modules/Users/Save.php:295 during installation
|
||||
$_POST['email_reminder_checked'] = false;
|
||||
try {
|
||||
/*
|
||||
* Do some cleanup so we can relaunch installer over and over again (we can get rid of this)
|
||||
*/
|
||||
if(is_file("config.php")) {
|
||||
unlink("config.php");
|
||||
}
|
||||
ob_start();
|
||||
require_once 'install.php';
|
||||
ob_end_clean();
|
||||
} catch(\Exception $e) {
|
||||
echo "\nINSTALLATION FAILED! file: " . $e->getFile() . " - line: " . $e->getLine()
|
||||
. "\n" . $e->getMessage()
|
||||
. "\n" . str_repeat("-", 120)
|
||||
. "\n" . print_r($e->getTrace(), true)
|
||||
. "\n" . str_repeat("-", 120)
|
||||
. "\n";
|
||||
}
|
||||
|
||||
// Set up autoloading and bootstrap SuiteCRM test suite
|
||||
|
||||
/* bootstrap composer's autoloader */
|
||||
require_once '../vendor/autoload.php';
|
||||
|
||||
/* bootstrap sugarcrm */
|
||||
chdir('../');
|
||||
define('sugarEntry',TRUE);
|
||||
global $sugar_config, $db;
|
||||
require_once 'include/utils.php';
|
||||
require_once 'include/modules.php';
|
||||
require_once 'include/entryPoint.php';
|
||||
//Oddly entry point loads app_strings but not app_list_strings, manually do this here.
|
||||
$GLOBALS['app_list_strings'] = return_app_list_strings_language($GLOBALS['current_language']);
|
||||
|
||||
/* VERY BAD :-( - but for now at least tests are running */
|
||||
$GLOBALS['sugar_config']['resource_management']['default_limit'] = 999999;
|
||||
|
||||
|
||||
define('SUITE_PHPUNIT_RUNNER', true)
|
1
tests/_data/dump.sql
Normal file
1
tests/_data/dump.sql
Normal file
|
@ -0,0 +1 @@
|
|||
/* Replace this file with actual dump of your database */
|
2
tests/_output/.gitignore
vendored
Normal file
2
tests/_output/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
*
|
||||
!.gitignore
|
26
tests/_support/AcceptanceTester.php
Normal file
26
tests/_support/AcceptanceTester.php
Normal file
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* Inherited Methods
|
||||
* @method void wantToTest($text)
|
||||
* @method void wantTo($text)
|
||||
* @method void execute($callable)
|
||||
* @method void expectTo($prediction)
|
||||
* @method void expect($prediction)
|
||||
* @method void amGoingTo($argumentation)
|
||||
* @method void am($role)
|
||||
* @method void lookForwardTo($achieveValue)
|
||||
* @method void comment($description)
|
||||
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
|
||||
*
|
||||
* @SuppressWarnings(PHPMD)
|
||||
*/
|
||||
class AcceptanceTester extends \Codeception\Actor
|
||||
{
|
||||
use _generated\AcceptanceTesterActions;
|
||||
|
||||
/**
|
||||
* Define custom actions here
|
||||
*/
|
||||
}
|
26
tests/_support/FunctionalTester.php
Normal file
26
tests/_support/FunctionalTester.php
Normal file
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* Inherited Methods
|
||||
* @method void wantToTest($text)
|
||||
* @method void wantTo($text)
|
||||
* @method void execute($callable)
|
||||
* @method void expectTo($prediction)
|
||||
* @method void expect($prediction)
|
||||
* @method void amGoingTo($argumentation)
|
||||
* @method void am($role)
|
||||
* @method void lookForwardTo($achieveValue)
|
||||
* @method void comment($description)
|
||||
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
|
||||
*
|
||||
* @SuppressWarnings(PHPMD)
|
||||
*/
|
||||
class FunctionalTester extends \Codeception\Actor
|
||||
{
|
||||
use _generated\FunctionalTesterActions;
|
||||
|
||||
/**
|
||||
* Define custom actions here
|
||||
*/
|
||||
}
|
10
tests/_support/Helper/Acceptance.php
Normal file
10
tests/_support/Helper/Acceptance.php
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
namespace Helper;
|
||||
|
||||
// here you can define custom actions
|
||||
// all public methods declared in helper class will be available in $I
|
||||
|
||||
class Acceptance extends \Codeception\Module
|
||||
{
|
||||
|
||||
}
|
10
tests/_support/Helper/Functional.php
Normal file
10
tests/_support/Helper/Functional.php
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
namespace Helper;
|
||||
|
||||
// here you can define custom actions
|
||||
// all public methods declared in helper class will be available in $I
|
||||
|
||||
class Functional extends \Codeception\Module
|
||||
{
|
||||
|
||||
}
|
10
tests/_support/Helper/Unit.php
Normal file
10
tests/_support/Helper/Unit.php
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
namespace Helper;
|
||||
|
||||
// here you can define custom actions
|
||||
// all public methods declared in helper class will be available in $I
|
||||
|
||||
class Unit extends \Codeception\Module
|
||||
{
|
||||
|
||||
}
|
26
tests/_support/UnitTester.php
Normal file
26
tests/_support/UnitTester.php
Normal file
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* Inherited Methods
|
||||
* @method void wantToTest($text)
|
||||
* @method void wantTo($text)
|
||||
* @method void execute($callable)
|
||||
* @method void expectTo($prediction)
|
||||
* @method void expect($prediction)
|
||||
* @method void amGoingTo($argumentation)
|
||||
* @method void am($role)
|
||||
* @method void lookForwardTo($achieveValue)
|
||||
* @method void comment($description)
|
||||
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
|
||||
*
|
||||
* @SuppressWarnings(PHPMD)
|
||||
*/
|
||||
class UnitTester extends \Codeception\Actor
|
||||
{
|
||||
use _generated\UnitTesterActions;
|
||||
|
||||
/**
|
||||
* Define custom actions here
|
||||
*/
|
||||
}
|
2
tests/_support/_generated/.gitignore
vendored
Normal file
2
tests/_support/_generated/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
*
|
||||
!.gitignore
|
12
tests/acceptance.suite.yml
Normal file
12
tests/acceptance.suite.yml
Normal file
|
@ -0,0 +1,12 @@
|
|||
# Codeception Test Suite Configuration
|
||||
#
|
||||
# Suite for acceptance tests.
|
||||
# Perform tests in browser using the WebDriver or PhpBrowser.
|
||||
# If you need both WebDriver and PHPBrowser tests - create a separate suite.
|
||||
|
||||
class_name: AcceptanceTester
|
||||
modules:
|
||||
enabled:
|
||||
- PhpBrowser:
|
||||
url: http://localhost/myapp
|
||||
- \Helper\Acceptance
|
2
tests/acceptance/_bootstrap.php
Normal file
2
tests/acceptance/_bootstrap.php
Normal file
|
@ -0,0 +1,2 @@
|
|||
<?php
|
||||
// Here you can initialize variables that will be available to your tests
|
|
@ -1,57 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* SugarCRM Community Edition is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
|
||||
*
|
||||
* SuiteCRM is an extension to SugarCRM Community Edition developed by SalesAgility Ltd.
|
||||
* Copyright (C) 2011 - 2016 SalesAgility Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not
|
||||
* reasonably feasible for technical reasons, the Appropriate Legal Notices must
|
||||
* display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM".
|
||||
*/
|
||||
|
||||
/* bootstrap composer's autoloader */
|
||||
require_once '../vendor/autoload.php';
|
||||
|
||||
/* bootstrap sugarcrm */
|
||||
chdir('../');
|
||||
define('sugarEntry',TRUE);
|
||||
global $sugar_config, $db;
|
||||
require_once 'include/utils.php';
|
||||
require_once 'include/modules.php';
|
||||
require_once 'include/entryPoint.php';
|
||||
//Oddly entry point loads app_strings but not app_list_strings, manually do this here.
|
||||
$GLOBALS['app_list_strings'] = return_app_list_strings_language($GLOBALS['current_language']);
|
||||
|
||||
/* VERY BAD :-( - but for now at least tests are running */
|
||||
$GLOBALS['sugar_config']['resource_management']['default_limit'] = 999999;
|
||||
|
||||
|
||||
define('SUITE_PHPUNIT_RUNNER', true);
|
11
tests/functional.suite.yml
Normal file
11
tests/functional.suite.yml
Normal file
|
@ -0,0 +1,11 @@
|
|||
# Codeception Test Suite Configuration
|
||||
#
|
||||
# Suite for functional (integration) tests
|
||||
# Emulate web requests and make application process them
|
||||
# Include one of framework modules (Symfony2, Yii2, Laravel5) to use it
|
||||
|
||||
class_name: FunctionalTester
|
||||
modules:
|
||||
enabled:
|
||||
# add framework module here
|
||||
- \Helper\Functional
|
2
tests/functional/_bootstrap.php
Normal file
2
tests/functional/_bootstrap.php
Normal file
|
@ -0,0 +1,2 @@
|
|||
<?php
|
||||
// Here you can initialize variables that will be available to your tests
|
|
@ -1,20 +0,0 @@
|
|||
<phpunit
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation = "http://schema.phpunit.de/3.7/phpunit.xsd"
|
||||
backupGlobals = "true"
|
||||
backupStaticAttributes = "false"
|
||||
colors = "false"
|
||||
convertNoticesToExceptions = "true"
|
||||
convertWarningsToExceptions = "true"
|
||||
convertErrorsToExceptions = "true"
|
||||
processIsolation = "false"
|
||||
stopOnFailure = "false"
|
||||
syntaxCheck = "false"
|
||||
bootstrap = "bootstrap.php"
|
||||
>
|
||||
<testsuites>
|
||||
<testsuite name="AllTests">
|
||||
<directory>tests/</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
</phpunit>
|
|
@ -1,2 +0,0 @@
|
|||
#!/bin/sh
|
||||
../vendor/bin/phpunit
|
|
@ -1,36 +0,0 @@
|
|||
<?php
|
||||
/* DEFINE SOME VARIABLES FOR INSTALLER */
|
||||
$_SERVER['HTTP_HOST'] = 'localhost';
|
||||
$_SERVER['REQUEST_URI'] = 'install.php';
|
||||
$_SERVER["SERVER_SOFTWARE"] = 'Apache';
|
||||
$_SERVER['SERVER_NAME'] = 'travis';
|
||||
$_SERVER['SERVER_PORT'] = '80';
|
||||
|
||||
$_REQUEST['goto'] = 'SilentInstall';
|
||||
$_REQUEST['cli'] = true;
|
||||
|
||||
// this will fix warning in modules/Users/Save.php:295 during installation
|
||||
$_POST['email_reminder_checked'] = false;
|
||||
|
||||
|
||||
try {
|
||||
/*
|
||||
* Do some cleanup so we can relaunch installer over and over again (we can get rid of this)
|
||||
*/
|
||||
if(is_file("config.php")) {
|
||||
unlink("config.php");
|
||||
}
|
||||
|
||||
ob_start();
|
||||
require_once 'install.php';
|
||||
ob_end_clean();
|
||||
} catch(\Exception $e) {
|
||||
echo "\nINSTALLATION FAILED! file: " . $e->getFile() . " - line: " . $e->getLine()
|
||||
. "\n" . $e->getMessage()
|
||||
. "\n" . str_repeat("-", 120)
|
||||
. "\n" . print_r($e->getTrace(), true)
|
||||
. "\n" . str_repeat("-", 120)
|
||||
. "\n";
|
||||
}
|
||||
|
||||
|
10
tests/unit.suite.yml
Normal file
10
tests/unit.suite.yml
Normal file
|
@ -0,0 +1,10 @@
|
|||
# Codeception Test Suite Configuration
|
||||
#
|
||||
# Suite for unit (internal) tests.
|
||||
|
||||
class_name: UnitTester
|
||||
modules:
|
||||
enabled:
|
||||
- Asserts
|
||||
- Db
|
||||
- \Helper\Unit
|
2
tests/unit/_bootstrap.php
Normal file
2
tests/unit/_bootstrap.php
Normal file
|
@ -0,0 +1,2 @@
|
|||
<?php
|
||||
// Here you can initialize variables that will be available to your tests
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue