Appendix C - Automated Testing

Introduction

Automated testing provides a means to ensure that the high quality of SuiteCRM is maintained. SuiteCRM has an automated test framework which is powered by the codeception testing framework.

Installing the testing framework

In your terminal emulator or command prompt:

cd /path/to/suitecrm/instance

Run the command:

composer install

Test Suites

SuiteCRM offers many different test suites.

Suite Description

acceptance

ensure that the software meets requirements of a user story

functional

ensure that the subsystems of the code base interact correctly

unit

Unit tests reflect that a single unit of code eg a method

api

functional test which test the api version 8 responses

install

acceptance test to test that the install wizard is working correctly

demo

used to test the suitecrm demo site

Running Codeception for the first time

Codeception and the other commands live inside the vendor/bin/ directory of your SuiteCRM instance. To test that your configuration is working you need to first install your copy of suitecrm. After installing SuiteCRM you can run the unit tests:

./vendor/bin/codecept run unit

Requirements

Each tests suite has its own set of requirements.

Unit tests

To run the unit test, you just need to the install the testing framework.

You can continue to run the unit test suite using the command:

./vendor/bin/codecept run unit

Functional and API tests

The functional and api tests require that you import the database (or .sql) files which exist the tests/_data folder. You also need to configure the test environment variables.

You can run the functional test suite using the command:

./vendor/bin/codecept run functional

You can run the api test suite using the command:

./vendor/bin/codecept run api

Acceptance, Demo and Install tests

The acceptance, demo and install tests require the test environment to be configured. You will also need to have en external testing browser service such as Selenium or Browser Stack.

You can run the acceptance test suite using the command:

./vendor/bin/codecept run acceptance

You can run the api test suite using the command:

./vendor/bin/codecept run api

Add vendor bin to your PATH

This will make it easier to run codeception and the other commands which live in vendor/bin/ directory. You can add the vendor/bin location to your PATH environment variable.

Adding vendor/bin to PATH (Bash):

export PATH=$PATH:/path/to/instance/vendor/bin

Adding vendor/bin to PATH (Command Prompt):

set PATH=%PATH%;C:\path\to\instance\vendor\bin

This allows you to call the codecept command without having to prefix the command with its location. When running codecept you should ensure that your current working directory is the same as your suitecrm instance.

cd /path/to/suitecrm/instance/

codecept run unit

Configuring the test environment

SuiteCRM requires you to configure the automated test with your development environment. There are a number of ways to configure your environment.

  • You can configure the automated test by adding an yml file to the tests/_envs folder

  • You can edit the yml files for each test suite

  • You can set up environment variables in the terminal or command prompt (recommended)

Environment Variables

This is the preferred method to store sensitive information, as it prevents security information from being committed to the git repository. You can automate different development environments using environment variables.

Test Suite Requirements

Install Test Suite:

Variable Description

DATABASE_DRIVER

MYSQL or MSSQL

DATABASE_HOST

path to database server

DATABASE_NAME

name of the database

DATABASE_USER

database user

DATABASE_PASSWORD

database password

Acceptance, API, and Install Test Suites:

Variable Description

INSTANCE_URL

URL of the SuiteCRM instance which the tester need to access

INSTANCE_ADMIN_USER

admin user for logging in

INSTANCE_ADMIN_PASSWORD

admin password for logging in

API Test Suites:

Variable Description

INSTANCE_CLIENT_ID

id of the client

INSTANCE_CLIENT_SECRET

secret of the client

Setup environment variables (bash):

Open terminal and run robo

./vendor/bin/robo configure:tests

Setup environment variables (Command Prompt):

Open terminal and run robo

.\vendor\bin\robo configure:tests

Setup environment variables (Docker Compose):

You can add a .env file into your docker compose setup:

DATABASE_DRIVER=MYSQL
DATABASE_NAME=automated_tests
DATABASE_HOST=localhost
DATABASE_USER=automated_tests
DATABASE_PASSWORD=automated_tests
INSTANCE_URL=http://path/to/instance
INSTANCE_ADMIN_USER=admin
INSTANCE_ADMIN_PASSWORD=admin
INSTANCE_CLIENT_ID=suitecrm_client
INSTANCE_CLIENT_SECRET=secret

then reference it in your php container (docker-compose.yml):

version: '3'
services:
  php:
      image: php:7.0-apache
      restart: always
      ports:
        - 9001:80
      environment:
       - DATABASE_DRIVER: $DATABASE_DRIVER
       - DATABASE_NAME: $DATABASE_NAME
       - DATABASE_HOST: $DATABASE_HOST
       - DATABASE_USER: $DATABASE_USER
       - DATABASE_PASSWORD: $DATABASE_PASSWORD
       - INSTANCE_URL: $INSTANCE_URL
       - INSTANCE_ADMIN_USER: $INSTANCE_ADMIN_USER
       - INSTANCE_ADMIN_PASSWORD: $INSTANCE_ADMIN_PASSWORD
       - INSTANCE_CLIENT_ID: $INSTANCE_CLIENT_ID
       - INSTANCE_CLIENT_SECRET: $INSTANCE_CLIENT_SECRET

Running the test environment

The SuiteCRM automated testing framework can support different environments. You can see the different configurations for test environments in tests/_env folder. There are different prefixes fore each testing environment you choose to deploy.

  • selenium- Configures the features for selenium web driver environment

  • browser-stack- Configures features for browser stack environment

  • travis-ci- Configures features for travis-ci environment

To run the tests in a single environment, add a --env flag to the codecept command; separating each configuration by a comma:

codecept run acceptance --env selenium-hub,selenium-iphone-6

It is also possible to run multi environments at the same time by adding multiple --env flags:

codecept run acceptance --env selenium-hub,selenium-iphone-6 --env selenium-hub,selenium-hd --env browser-stack,browser-stack-ipad-2

The tests will be executed 3 times, once for each environment

Selenium

The SuiteCRM testing framework can be configured to use selenium as the browser service.

Using Selenium with a local PHP environment

You may prefer to run in a local PHP environment instead of using docker compose. This requires you to have selenium running locally on your computer. When running in a local environment you do not need to include the selenium-hub environment variable. Instead, you must choose whichever browser you have set up locally:

codecept run demo --env selenium-chrome

Using Docker Compose with the Selenium Hub

In your selenium development environment it is recommended that you employ docker compose to set up a selenium hub with a selenium node. This will ensure your version of Chrome or Firefox is kept up-to-date with the latest version. In addition, you can also run multiple versions of PHP on the same host machine.

You can configure selenium using docker compose. Please ensure you have the following in your docker-compose.yml file.

version: '3'
services:
    selenium-hub:
      image: selenium/hub
      restart: always
      ports:
        - 4444:4444
    selenium-node-chrome:
      image: selenium/node-chrome-debug
      restart: always
      ports:
        - 5900:5900
      links:
        - selenium-hub:hub
      environment:
              - "HUB_PORT_4444_TCP_ADDR=selenium-hub"
              - "HUB_PORT_4444_TCP_PORT=4444"
    selenium-node-firefox:
      image: selenium/node-firefox-debug
      restart: always
      ports:
        - 5901:5900
      links:
        - selenium-hub:hub
      environment:
              - "HUB_PORT_4444_TCP_ADDR=selenium-hub"
              - "HUB_PORT_4444_TCP_PORT=4444"

Note: you can also choose different images for the nodes, for example the nodes without vnc support

Screen Resolutions / Fake Devices

Here are the different configurations for each target device we test for:

Device Resolution

selenium-iphone-6

375x667

selenium-ipad-2

768x1024

selenium-xga

1024x768

selenium-hd

1280x720

selenium-fhd

1920x1080

Run Selenium Hub

codecept run acceptance --env selenium-hub,selenium-xga

Please note: that the SuiteCRM automated test framework uses height and width values to define the window size instead of the window_size. window_size is ignored by the automated test framework.

Selecting Browser

You can select the browser you wish to test by adding it to the --env.

codecept run demo --env selenium-hub,selenium-chrome

or

codecept run demo --env selenium-hub,selenium-firefox

Browser Stack

The SuiteCRM testing framework can be configured to use browser stack service. It requires an account with Browser Stack that enables automated testing. You also need to configure the testing framework with your username and access key. You can get your details from the automate menu item.

Environment Variables

Browser Stack requires some extra environment variables to be configured:

Browser Stack:

Variable Description

BROWSERSTACK_USERNAME

browser stack user name

BROWSERSTACK_ACCESS_KEY

access to to use browser stack

Browser stack local

When you need to test a application that resides on a private server you will need to run the browser-stack-local env option:

codecept run demo --env browser-stack-hub,browser-stack-local

Devices

Here are the different configurations for each target device we test for:

Device Resolution

browser-stack-chrome-fhd

1920x1080

browser-stack-edge-fhd

1920x1080

browser-stack-firefox-fhd

1920x1080

browser-stack-safari-fhd

11920x1080

browser-stack-iphone-6

375x667

browser-stack-ipad-2

768x1024

using the following command:

codecept run demo --env browser-stack-hub,browser-stack-local,browser-stack-chrome-fhd

Code Coverage Infos

terminal command: ./vendor/bin/codecept run unit --coverage --coverage-html

output in: path/to/SuiteCRM/tests/_output/coverage/index.html

Writing and Running Tests

PHPUnit tests

PHPUnit tests are related to a unit you are testing. The path of the tests is identical to the path of the unit inside the tests/…​ folder. Each Unit test class has a suffix …​Test and should extend the SuiteCRM\StateCheckerPHPUnitTestCaseAbstract class. Test methods prefix is test…​.

E.g. if the /path/to/Example.php contains a class Example then the related test should be in the tests/path/to/ExampleTest.php:

Example for a PHPUnit test

contents of tests/path/to/ExampleTest.php:

use SuiteCRM;

// note: SuiteCRM\StateCheckerPHPUnitTestCaseAbstract extends PHPUnit_Framework_TestCase;

class ExampleTest extends StateCheckerPHPUnitTestCaseAbstract {

    public function testDoingSomething() {
        $example = new Example();
        $results = $example->goSomthing();
        $this->assertSame('expected value', $results);
    }

}

See more about PHPUnit tests at https://phpunit.readthedocs.io

Codeception Unit Tests

Codeception also supports unit tests based on the PHPUnit framework. See more about Codeception unit tests at https://codeception.com/docs/05-UnitTests

Example for a Codeception Unit Test

use SuiteCRM;

// note: SuiteCRM\StateCheckerUnitAbstract extends \Codeception\Test\Unit;


class ExampleTest extends StateCheckerUnitAbstract
{
    public function testDoingSomething()
    {
        $example = new Example();
        $results = $example->goSomthing();
        $this->assertSame('expected value', $results);
    }
}

Codeception Functional and Acceptance Tests

Implementation of state safe functional and acceptance tests.

Example for Functional and/or Acceptance tests

use SuiteCRM;

class SigninCest extends StateCheckerCestAbstract
{
    public function tryToTest(AcceptanceTester $I)
    {
        $I->wantTo('test my page');
    }
}

Test classes:

  • abstract class SuiteCRM\StateCheckerPHPUnitTestCaseAbstract

Implementation of state checker Codeception tests, class StateCheckerPHPUnitTestCaseAbstract extends PHPUnit_Framework_TestCase and override setUp() and tearDown() methods so if you want to call these methods in the inheritance test classes you should call parent::setUp() and parent::tearDown() in it.


  • abstract class SuiteCRM\StateCheckerUnitAbstract

Implementation of state checker Codeception tests, class StateCheckerUnitAbstract extends Codeception\Test\Unit and override _before() and _after() methods so if you want to call these methods in the inheritance test classes you should call parent::_before() and parent::_after() in it.


  • abstract class SuiteCRM\StateCheckerCestAbstract

Implementation of state checker Codeception tests, it uses _before() and _after() methods so if you want to call these methods in the heritance test classes you should call parent::_before() and parent::_after() in it.


  • trait SuiteCRM\StateCheckerCodeceptionTrait

Used in state checker Codeception tests.


  • trait SuiteCRM\StateCheckerTrait

Used in state checker tests.


  • Running all unit tests class:

$ vendor/bin/codecept run unit -f --steps -vvv --debug

  • Running only one unit tests class:

$ vendor/bin/codecept run unit -f --steps -vvv --debug /path/to/YourTest.php

  • Running unit tests state check per classes

By default the state checker tests store and check the system state only before and after the test classes.
You can manipulate this behavior in your config_override.php with
$sugar_config['state_checker']['test_state_check_mode'] value OR
just simply switch on/off the developer mode in administration panel.
See more at class SuiteCRM\StateCheckerConfig

  • Running unit tests state check per methods

Slow working but give a detailed information about which test method change the state in the class.
You can manipulate this behavior in your config_override.php with
$sugar_config['state_checker']['test_state_check_mode'] value OR
just simply switch on/off the developer mode in administration panel.
See more at class SuiteCRM\StateCheckerConfig

  • Configuration of state checker tests -see SuiteCRM\StateCheckerConfig class.

State Safe Tests

StateSaver and StateChecker

  • State check library for SuperGlobals, FileSystem and DataBase etc. (Implemented for: PHP Unit tests and Codeception Cests.)

  • State saver library - helper classes for developers.

Keep the system global environment state clean, especially in tests.
If a test leaves some extra data in the database, file system or super globals etc. this could change the behaviour of the other test processes. When you write a new test make sure it is state safe, which means tests should not leave any 'garbage' data in the test environment state such as database, file system, superglobals etc..

  • Check System State

Unit test should be stateless, developers can change class StateCheckerConfig properties in local instance to make sure Unit tests don’t change the system state.

PHPUnit tests have to extend SuiteCRM\StateCheckerPHPUnitTestCaseAbstract instead of PHPUnit_Framework_TestCase.

Codeception Cests should extend SuiteCRM\StateCheckerCestAbstract class. (note: don’t forget to call parent::_before() and parent::_after() if you want to override these methods in your tests)

The following classes help you to write state-safe code (tests), of course you can use some of these classes in any case where you have to change and restore anything in the global system state:


  • Class SuiteCRM\StateSaver

Saves and checks the system state and reports any state change in the following:

  • Database

  • File system

  • Super globals

  • PHP error reporting level

  • PHP configuration options

See also SuiteCRM\StateChecker class.

  • Examples for storing superglobals:

use SuiteCRM;

$_POST['foo'] = 'bar';

// create a new instance of StateChecker:
$stateSaver = new StateSaver();

// save all superglobals
$stateSaver->pushGlobals();

$_POST['foo'] = 'bazz';

// restore super globals
$stateSaver->popGlobals();

echo $_POST['foo']; // output: bar
  • Examples for storing database tables:

use SuiteCRM;

// create a new instance of StateChecker:
$stateSaver = new StateSaver();
$stateSaver->pushTable('stufftable');

// modify your database table here. (insert/update/delete..)
...

$stateSaver->popTable('stufftable');

// restore your database table 'stufftable' here.
  • Examples for Check System State in Tests:

Example output when the test redefines superglobals:

for e.g:

`$_POST['foo'] = 'bar';`

output:

"/usr/bin/php" "/var/www/html/SuiteCRM/vendor/bin/codecept" "run" "unit" "-f" "--steps" "-vvv" "--debug"
Cannot load Xdebug - extension already loaded
Codeception PHP Testing Framework v2.4.0
Powered by PHPUnit 4.8.36 by Sebastian Bergmann and contributors.

Unit Tests (1583) --------------------------------------------------------------
Modules: Asserts, \Helper\Unit
--------------------------------------------------------------------------------
- configTest: Test_config
✖ configTest: Test_config (16.57s)
--------------------------------------------------------------------------------


Time: 29.52 seconds, Memory: 2288.50MB

There was 1 failure:

---------
1) configTest: Test_config
 Test  tests/unit/configTest.php:test_config
Incorrect state hash: Hash doesn't match at key "globals::_POST"
...

Example 2: file changed:

`file_put_contents('foo.txt', rand(0, 1234));`

output:

"/usr/bin/php" "/var/www/html/SuiteCRM/vendor/bin/codecept" "run" "unit" "-f" "--steps" "-vvv" "--debug"
Cannot load Xdebug - extension already loaded
Codeception PHP Testing Framework v2.4.0
Powered by PHPUnit 4.8.36 by Sebastian Bergmann and contributors.

Unit Tests (1583) --------------------------------------------------------------
Modules: Asserts, \Helper\Unit
--------------------------------------------------------------------------------
- configTest: Test_config
✖ configTest: Test_config (10.79s)
--------------------------------------------------------------------------------


Time: 23.12 seconds, Memory: 1875.00MB

There was 1 failure:

---------
1) configTest: Test_config
 Test  tests/unit/configTest.php:test_config
Incorrect state hash: Hash doesn't match at key "filesys::/var/www/html/SuiteCRM/foo.txt".
...
  • Example usage for System State Saver in test scripts:

StateSaver class is a helper library, typically for test scripts but usable everywhere:

	// Save state

        // Create an instance of StateChecker
        $state = new \SuiteCRM\StateSaver();
        $state->pushGlobals();    // saving superglobals
        $state->pushTable('your_module_stuffs'); // saving a database table
        $state->pushFile('your_file.txt');

        // Tests

	// Do some test changes in superglobals
        $_POST['foo'] = 'bar';

        // Test changes in database tables (example only)
        $stuff = BeanFactory::getBean('YourModuleStuff', '{your-module-stuff-id}');
        $stuff->your_property = 'baz';
        $stuff->save();

        // Some changes in your test file:
        file_put_contents('your-file.txt', 'New contents here: ' . rand(1, 10000));


        // Clean up

        $state->popFile('your_file.txt');
        $state->popTable('your_module_stuffs');  // restore table
        $state->popGlobals();  // restore globals

        // ... here you should get the restored super globals, database tables and files.
  • Available methods:

Error Collection:

    /**
     * Retrieve if any error occurred in storing/restoring processes.
     *
     * @return array
     */
    public function getErrors();
    /**
     * Clear all collected error information about latest storing/restoring processes.
     */
    public function clearErrors();
    /**
     * Retrieve if any error occurred in storing/restoring processes and
     * clear all collected error information about latest storing/restoring processes.
     *
     * @return array
     */
    public function getErrorsClear();

Push/pop stack storeage:

    /**
     * Save any value into state store at a key and namespace.
     *
     * @param mixed $value
     * @param string $key
     * @param string $namespace
     */
    public function push($value, $key, $namespace);
    /**
     * Restore any value from state store at a key and namespace.
     *
     * @param string $key
     * @param string $namespace
     * @return mixed
     */
    public function pop($key, $namespace);
    /**
     * Save a global variable into storage at an optional namespace.
     *
     * @param string $key
     * @param string $namespace
     */
    public function pushGlobal($key, $namespace = 'GLOBALS');
    /**
     * Restore a global value from storage at an optional namespace.
     *
     * @param string $key
     * @param string $namespace
     */
    public function popGlobal($key, $namespace = 'GLOBALS');
    /**
     * Save all super globals which are specified in configuration.
     * @see StateCheckerConfig
     *
     * pushGlobals
     */
    public function pushGlobals();
    /**
     * Restore all super globals which are specified in configuration.
     * @see StateCheckerConfig
     *
     * popGlobals
     */
    public function popGlobals();
    /**
     * Save all defined global variable name.
     * (note: this function does not store the values, so use it carefully)
     *
     * pushGlobalKeys
     */
    public function pushGlobalKeys();
    /**
     * Restore all defined global variable name.
     * (note: this function does not restore the values, so use it carefully)
     *
     * popGlobalKeys
     */
    public function popGlobalKeys();
    /**
     * Save Error Reporting Level into the store at an optional key and namespace.
     * (note: error level should not be changed for any reason, so use it for own risk)
     *
     * @param string $key
     * @param string $namespace
     */
    public function pushErrorLevel($key = 'level', $namespace = 'error_reporting');
    /**
     * Restore Error Reporting Level from the store at an optional key and namespace.
     * (note: error level should not be changed for any reason, so use it for own risk)
     *
     * @param string $key
     * @param string $namespace
     */
    public function popErrorLevel($key = 'level', $namespace = 'error_reporting');
    /**
     * Save all data from a database table into store at an optional namespace.
     *
     * @param string $table
     * @param string $namespace
     * @throws StateSaverException
     */
    public function pushTable($table, $namespace = 'db_table');
    /**
     * Restore all data into a database table from store at an optional namespace.
     *
     * @param string $table
     * @param string $namespace
     */
    public function popTable($table, $namespace = 'db_table');

File system

    /**
     * Save a file contents.
     *
     * @param string $filename
     * @throws StateSaverException
     */
    public function pushFile($filename);
    /**
     * Restore a file contents.
     *
     * @param string $filename
     * @return boolean
     * @throws StateSaverException
     */
    public function popFile($filename);

PHP Configuration options:

    /**
     * Getter for PHP Configuration Options
     * @see more at StateCheckerConfig::$phpConfigOptionKeys
     *
     * @return array
     */
    public static function getPHPConfigOptions();
    /**
     * Setter for PHP Configuration Options
     * @see more at StateCheckerConfig::$phpConfigOptionKeys
     *
     * @param array $configOptions
     * @throws StateSaverException
     */
    public static function setPHPConfigOptions($configOptions);
    /**
     * Store PHP Configuration Options
     * @see more at StateCheckerConfig::$phpConfigOptionKeys
     *
     * @param string $key
     * @param string $namespace
     */
    public function pushPHPConfigOptions($key = 'all', $namespace = 'php_config_options');
    /**
     * Restore PHP Configuration Options
     * @see more at StateCheckerConfig::$phpConfigOptionKeys
     *
     * @param string $key
     * @param string $namespace
     */
    public function popPHPConfigOptions($key = 'all', $namespace = 'php_config_options');

  • class SuiteCRM\StateSaverException (Exception)

Simple Exception to catch and handle the state changes.


  • class SuiteCRM\StateChecker

Saves and checks the system state and reports any state change in the following: - Database - File system - Super globals - PHP error reporting level - PHP configuration options

See more about the SuiteCRM\StateChecker configuration in the SuiteCRM\StateCheckerConfig class.

Examples:

use SuiteCRM;

// saving a hash of the current state at this point.
$stateChecker = new StateChecker();

// ... do something to change the current system state

try {

    // getting a hash of the current state or
    // throws an exception if the state doesn't match with the previously saved state.

    $hash = $stateChecker->getStateHash();

} catch (StateCheckerException $e) {

    // state is changed!
    // use the following exception to detect / debug the problem: (optional)

    $info = $e->getMessage();

}

  • class SuiteCRM\StateCheckerException (extends PHP standard Exception)

Simple Exception to catch and handle the state changes.


  • class SuiteCRM\StateCheckerConfig

Configuration of SuiteCRM\StateChecker and StateChecker Tests classes such as:

SuiteCRM\StateCheckerPHPUnitTestCaseAbstract
SuiteCRM\StateCheckerUnitAbstract
SuiteCRM\StateCheckerCestAbstract

SuiteCRM\StateCheckerConfig configuration options have default values and each is available in
$sugar_config['state_checker'][$key].

Each configuration value is available with a getter method:
SuiteCRM\StateCheckerConfig::get($key) where $key could be any of the following:


globalKeys

The SuperGlobals Collection determines which super globals are stored and restored.

Usage:

$value = SuiteCRM\StateCheckerConfig::get('globalKeys')

Default return value:

array('_POST', '_GET', '_REQUEST', '_SESSION', '_SERVER', '_ENV', '_FILES', '_COOKIE')

SuiteCRM config overrides:

$sugar_config['state_checker']['global_keys']

fileExludeRegexes

Array of regexp for excluding files from state checking.
Tests won’t check hash for these files so won’t fail.

Usage:

$value = SuiteCRM\StateCheckerConfig::get('fileExludeRegexes')

Default value:

array(
    '/\/\.git\//',
    '/\/cache\//',
    '/\.log$/',
    '/\/tests\/_output\//',
    '/\/blowfish\//',
    '/\/upload\//',
    '/\/vendor\//',
    '/\/sugarfield_jjwg_maps_/',
    '/\/vardefs.ext.php$/',
    '/\/modules\/AOD_Index\/Index\/Index\//',
    '/\/travis\/build\//',
)

SuiteCRM config overrides:

$sugar_config['state_checker']['file_exclude_regexes']

autoRun

Automatically run state collection in StateChecker constructor.

Usage:

$value = SuiteCRM\StateCheckerConfig::get('autoRun')

Default value:

true

SuiteCRM config overrides:

$sugar_config['state_checker']['auto_run']

saveTraces

Saves trace info on state-hash mismatch
(Slow running but gives more information about the error location, use in development only)

Usage:

$value = SuiteCRM\StateCheckerConfig::get('saveTraces')

Default value:

false

SuiteCRM config overrides:

$sugar_config['state_checker']['save_traces']

redefineMemoryLimit

Redefine memory limit
(For more memory expensive tasks, for e.g collection stack trace information when $saveTraces is ON,
use in development only)

Usage:

$value = SuiteCRM\StateCheckerConfig::get('redefineMemoryLimit')

Default value:

false

SuiteCRM config overrides:

$sugar_config['state_checker']['redefine_memory_limit']

storeDetails

Stores more information about hash-mismatch, which part has state of globals/filesys/database.
(Slow working but gives more information about the error location, use in development only)

Usage:

$value = SuiteCRM\StateCheckerConfig::get('storeDetails')

Default value:

true

SuiteCRM config overrides:

$sugar_config['state_checker']['store_details']

testStateCheckMode

Enum specified that tests need to check system state for Test Cases behaviour, possible values:

SuiteCRM\StateCheckerConfig::RUN_NEVER: State check and save never runs.
SuiteCRM\StateCheckerConfig::RUN_PER_TEST: State check runs after each test methods.
SuiteCRM\StateCheckerConfig::RUN_PER_CLASSES: State check runs after each test class.

Note: Mode RUN_PER_CLASSES affects PHPUnit Test Cases only
Note: Developer mode overrides this value.

Usage:

$value = SuiteCRM\StateCheckerConfig::get('testStateCheckMode')

Default value:

SuiteCRM\StateCheckerConfig::RUN_PER_CLASSES

SuiteCRM config overrides:

$sugar_config['state_checker']['test_state_check_mode']

testsUseStateChecker

Test using StateChecker
(Slow working but gives more information about the error location, use in development only)

Usage:

$value = SuiteCRM\StateCheckerConfig::get('testsUseStateChecker')

Default value:

true

SuiteCRM config overrides:

$sugar_config['state_checker']['tests_use_state_checker']

testsUseAssertionFailureOnError

Test shows up an assertion failure when there is a hash-mismatch,
use $testsUseStateChecker also, $testsUseAssertionFailureOnError applied only if $testsUseStateChecker = true (use in development only)

Usage:

$value = SuiteCRM\StateCheckerConfig::get('testsUseAssertionFailureOnError')

Default value:

true

SuiteCRM config overrides:

$sugar_config['state_checker']['tests_use_assertion_failure_on_error']

testsFailureExcludeKeys

Tests won’t check hash for these keys so won’t fail
(It should be empty)

Usage:

$value = SuiteCRM\StateCheckerConfig::get('testsFailureExcludeKeys')

Default value:

array()

SuiteCRM config overrides:

$sugar_config['state_checker']['tests_failure_exclude_keys']

phpConfigOptionKeys

State saver needs to know which PHP configuration options to save/restore.

Usage:

$value = SuiteCRM\StateCheckerConfig::get('phpConfigOptionKeys')

Default value:

array('max_execution_time', 'display_errors', 'display_startup_errors')

SuiteCRM config overrides:

$sugar_config['state_checker']['php_configuration_option_keys']

Content is available under GNU Free Documentation License 1.3 or later unless otherwise noted.