Page MenuHomeIn-Portal Phabricator

D494.id1298.diff
No OneTemporary

File Metadata

Created
Sat, Feb 1, 8:51 PM

D494.id1298.diff

Index: branches/5.2.x/composer.json
===================================================================
--- branches/5.2.x/composer.json
+++ branches/5.2.x/composer.json
@@ -9,7 +9,7 @@
"require-dev": {
"behat/mink": "^1.7",
"aik099/phpunit-mink": "^2.4",
- "yoast/phpunit-polyfills": "^1.1",
+ "yoast/phpunit-polyfills": "^2.0",
"qa-tools/qa-tools": "^1.2",
"phpspec/prophecy": "^1.10",
"aik099/coding-standard": "dev-in-portal"
Index: branches/5.2.x/composer.lock
===================================================================
--- branches/5.2.x/composer.lock
+++ branches/5.2.x/composer.lock
@@ -4,20 +4,20 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "446cbcf570fca40149427fa3c80c43be",
+ "content-hash": "6ee270cc584b92544d79e7879fd6158f",
"packages": [
{
"name": "composer/ca-bundle",
- "version": "1.4.3",
+ "version": "1.4.4",
"source": {
"type": "git",
"url": "https://github.com/composer/ca-bundle.git",
- "reference": "031d14d579d2fa090b8049586325faf746abd1ca"
+ "reference": "14756a2c62df6395822301372d021337ed33029a"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/composer/ca-bundle/zipball/031d14d579d2fa090b8049586325faf746abd1ca",
- "reference": "031d14d579d2fa090b8049586325faf746abd1ca",
+ "url": "https://api.github.com/repos/composer/ca-bundle/zipball/14756a2c62df6395822301372d021337ed33029a",
+ "reference": "14756a2c62df6395822301372d021337ed33029a",
"shasum": ""
},
"require": {
@@ -64,7 +64,7 @@
"support": {
"irc": "irc://irc.freenode.org/composer",
"issues": "https://github.com/composer/ca-bundle/issues",
- "source": "https://github.com/composer/ca-bundle/tree/1.4.3"
+ "source": "https://github.com/composer/ca-bundle/tree/1.4.4"
},
"funding": [
{
@@ -80,7 +80,7 @@
"type": "tidelift"
}
],
- "time": "2024-07-08T15:22:14+00:00"
+ "time": "2024-09-25T07:48:01+00:00"
},
{
"name": "mtdowling/cron-expression",
@@ -2380,21 +2380,21 @@
},
{
"name": "yoast/phpunit-polyfills",
- "version": "1.1.1",
+ "version": "2.0.2",
"source": {
"type": "git",
"url": "https://github.com/Yoast/PHPUnit-Polyfills.git",
- "reference": "a0f7d708794a738f328d7b6c94380fd1d6c40446"
+ "reference": "562f449a2ec8ab92fe7b30d94da9622c7b1345fe"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/Yoast/PHPUnit-Polyfills/zipball/a0f7d708794a738f328d7b6c94380fd1d6c40446",
- "reference": "a0f7d708794a738f328d7b6c94380fd1d6c40446",
+ "url": "https://api.github.com/repos/Yoast/PHPUnit-Polyfills/zipball/562f449a2ec8ab92fe7b30d94da9622c7b1345fe",
+ "reference": "562f449a2ec8ab92fe7b30d94da9622c7b1345fe",
"shasum": ""
},
"require": {
- "php": ">=5.4",
- "phpunit/phpunit": "^4.8.36 || ^5.7.21 || ^6.0 || ^7.0 || ^8.0 || ^9.0"
+ "php": ">=5.6",
+ "phpunit/phpunit": "^5.7.21 || ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0"
},
"require-dev": {
"php-parallel-lint/php-console-highlighter": "^1.0.0",
@@ -2404,7 +2404,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-main": "2.x-dev"
+ "dev-main": "3.x-dev"
}
},
"autoload": {
@@ -2439,7 +2439,7 @@
"security": "https://github.com/Yoast/PHPUnit-Polyfills/security/policy",
"source": "https://github.com/Yoast/PHPUnit-Polyfills"
},
- "time": "2024-04-05T16:01:51+00:00"
+ "time": "2024-09-06T22:38:28+00:00"
}
],
"aliases": [],
Index: branches/5.2.x/core/kernel/application.php
===================================================================
--- branches/5.2.x/core/kernel/application.php
+++ branches/5.2.x/core/kernel/application.php
@@ -797,8 +797,11 @@
$this->registerClass('Page', KERNEL_PATH . '/tests/Page/Page.php');
$this->registerClass('QAToolsUrlBuilder', KERNEL_PATH . '/tests/Url/QAToolsUrlBuilder.php');
$this->registerClass('QAToolsUrlFactory', KERNEL_PATH . '/tests/Url/QAToolsUrlFactory.php');
- $this->registerClass('AbstractTestCase', KERNEL_PATH . '/../tests/AbstractTestCase.php');
- $this->registerClass('AbstractBrowserTestCase', KERNEL_PATH . '/../tests/AbstractBrowserTestCase.php');
+ $this->registerClass('AbstractTestCase', KERNEL_PATH . '/../tests/Unit/AbstractTestCase.php');
+ $this->registerClass(
+ 'AbstractBrowserTestCase',
+ KERNEL_PATH . '/../tests/Functional/AbstractBrowserTestCase.php'
+ );
// do not move to config - this helper is used before configs are read
$this->registerClass('kModulesHelper', KERNEL_PATH . self::MODULE_HELPER_PATH, 'ModulesHelper');
Index: branches/5.2.x/core/tests/AbstractBrowserTestCase.php
===================================================================
--- branches/5.2.x/core/tests/AbstractBrowserTestCase.php
+++ branches/5.2.x/core/tests/AbstractBrowserTestCase.php
@@ -1,119 +0,0 @@
-<?php
-/**
-* @version $Id$
-* @package In-Portal
-* @copyright Copyright (C) 1997 - 2023 Intechnic. All rights reserved.
-* @license GNU/GPL
-* In-Portal is Open Source software.
-* This means that this software may have been modified pursuant
-* the GNU General Public License, and as distributed it includes
-* or is derivative of works licensed under the GNU General Public License
-* or other free or open source software licenses.
-* See http://www.in-portal.org/license for copyright notices and details.
-*/
-
-use aik099\PHPUnit\BrowserTestCase;
-use QATools\QATools\HtmlElements\TypifiedPageFactory;
-use QATools\QATools\PageObject\Container;
-
-abstract class AbstractBrowserTestCase extends BrowserTestCase
-{
-
- /**
- * Browsers to use for tests.
- *
- * @var array
- */
- public static $browsers = array(
- array('alias' => 'default'),
- );
-
- /**
- * Page factory.
- *
- * @var TypifiedPageFactory
- */
- protected $pageFactory;
-
- /**
- * Reference to kApplication class instance.
- *
- * @var kApplication
- */
- protected $Application = null;
-
- /**
- * Connection to database
- *
- * @var IDBConnection
- */
- protected $Conn;
-
- /**
- * Constructs a test case with the given name.
- *
- * @param string $name Test case name.
- * @param array $data Data.
- * @param string $data_name Data name.
- *
- * @access public
- */
- public function __construct($name = null, array $data = array(), $data_name = '')
- {
- parent::__construct($name, $data, $data_name);
-
- $this->Application =& kApplication::Instance();
- $this->Conn =& $this->Application->GetADODBConnection();
- }
-
- /**
- * Creates factory, that can be used for page creation in the tests.
- *
- * @return void
- * @before
- */
- protected function setUpTest()
- {
- $this->pageFactory = new TypifiedPageFactory($this->getSession(), $this->getPageFactoryConfig());
- }
-
- /**
- * Returns config object to be used during PageFactory initialization.
- *
- * @return Container
- */
- protected function getPageFactoryConfig()
- {
- $container = new Container();
- $container['url_factory'] = function () {
- return new QAToolsUrlFactory();
- };
-
- return $container;
- }
-
- /**
- * Gets browser configuration aliases.
- * Allows to decouple actual test server connection details from test cases.
- *
- * @return array
- */
- public function getBrowserAliases()
- {
- static $cache = null;
-
- if ( !isset($cache) ) {
- $cache = require_once WRITEABLE . '/mink_config.php';
-
- // The remote code coverage collection won't work without "baseUrl" in the browser configuration.
- foreach ( $cache as $alias_name => $browser_configuration ) {
- if ( !isset($browser_configuration['alias']) && !isset($browser_configuration['baseUrl']) ) {
- $cache[$alias_name]['baseUrl'] = $this->Application->BaseURL();
- }
- }
- }
-
- return $cache;
- }
-
-}
Index: branches/5.2.x/core/tests/AbstractTestCase.php
===================================================================
--- branches/5.2.x/core/tests/AbstractTestCase.php
+++ branches/5.2.x/core/tests/AbstractTestCase.php
@@ -1,51 +0,0 @@
-<?php
-/**
-* @version $Id$
-* @package In-Portal
-* @copyright Copyright (C) 1997 - 2023 Intechnic. All rights reserved.
-* @license GNU/GPL
-* In-Portal is Open Source software.
-* This means that this software may have been modified pursuant
-* the GNU General Public License, and as distributed it includes
-* or is derivative of works licensed under the GNU General Public License
-* or other free or open source software licenses.
-* See http://www.in-portal.org/license for copyright notices and details.
-*/
-
-use PHPUnit\Framework\TestCase as BaseTestCase;
-
-abstract class AbstractTestCase extends BaseTestCase
-{
-
- /**
- * Reference to kApplication class instance.
- *
- * @var kApplication
- */
- protected $Application = null;
-
- /**
- * Connection to database
- *
- * @var IDBConnection
- */
- protected $Conn;
-
- /**
- * Constructs a test case with the given name.
- *
- * @param string $name Test case name.
- * @param array $data Data.
- * @param string $data_name Data name.
- *
- * @access public
- */
- public function __construct($name = null, array $data = array(), $data_name = '')
- {
- parent::__construct($name, $data, $data_name);
-
- $this->Application =& kApplication::Instance();
- $this->Conn =& $this->Application->GetADODBConnection();
- }
-
-}
Index: branches/5.2.x/core/tests/Functional/AbstractBrowserTestCase.php
===================================================================
--- branches/5.2.x/core/tests/Functional/AbstractBrowserTestCase.php
+++ branches/5.2.x/core/tests/Functional/AbstractBrowserTestCase.php
@@ -0,0 +1,135 @@
+<?php
+/**
+* @version $Id$
+* @package In-Portal
+* @copyright Copyright (C) 1997 - 2023 Intechnic. All rights reserved.
+* @license GNU/GPL
+* In-Portal is Open Source software.
+* This means that this software may have been modified pursuant
+* the GNU General Public License, and as distributed it includes
+* or is derivative of works licensed under the GNU General Public License
+* or other free or open source software licenses.
+* See http://www.in-portal.org/license for copyright notices and details.
+*/
+
+use aik099\PHPUnit\BrowserTestCase;
+use QATools\QATools\HtmlElements\TypifiedPageFactory;
+use QATools\QATools\PageObject\Container;
+
+abstract class AbstractBrowserTestCase extends BrowserTestCase
+{
+
+ /**
+ * Browsers to use for tests.
+ *
+ * @var array
+ */
+ public static $browsers = array(
+ array('alias' => 'default'),
+ );
+
+ /**
+ * Browser aliases.
+ *
+ * @var array
+ */
+ protected static $browserAliases;
+
+ /**
+ * Page factory.
+ *
+ * @var TypifiedPageFactory
+ */
+ protected $pageFactory;
+
+ /**
+ * Reference to kApplication class instance.
+ *
+ * @var kApplication
+ */
+ protected $Application = null;
+
+ /**
+ * Connection to database
+ *
+ * @var IDBConnection
+ */
+ protected $Conn;
+
+ /**
+ * Constructs a test case with the given name.
+ *
+ * @param string $name Test case name.
+ * @param array $data Data.
+ * @param string $data_name Data name.
+ *
+ * @access public
+ */
+ public function __construct($name = null, array $data = array(), $data_name = '')
+ {
+ parent::__construct($name, $data, $data_name);
+
+ $this->Application =& kApplication::Instance();
+ $this->Conn =& $this->Application->GetADODBConnection();
+ }
+
+ /**
+ * Creates factory, that can be used for page creation in the tests.
+ *
+ * @return void
+ * @before
+ */
+ protected function setUpTest()
+ {
+ $this->pageFactory = new TypifiedPageFactory($this->getSession(), $this->getPageFactoryConfig());
+ }
+
+ /**
+ * Returns config object to be used during PageFactory initialization.
+ *
+ * @return Container
+ */
+ protected function getPageFactoryConfig()
+ {
+ $container = new Container();
+ $container['url_factory'] = function () {
+ return new QAToolsUrlFactory();
+ };
+
+ return $container;
+ }
+
+ /**
+ * Gets browser configuration aliases.
+ * Allows to decouple actual test server connection details from test cases.
+ *
+ * @return array
+ * @throws RuntimeException When Mink configuration file is missing.
+ */
+ public function getBrowserAliases()
+ {
+ static $cache = null;
+
+ if ( self::$browserAliases === null ) {
+ $config_file = WRITEABLE . '/mink_config.php';
+
+ if ( !file_exists($config_file) ) {
+ throw new RuntimeException('The Mink configuration file does not exist.');
+ }
+
+ $cache = require_once $config_file;
+
+ // The remote code coverage collection won't work without "baseUrl" in the browser configuration.
+ foreach ( $cache as $alias_name => $browser_configuration ) {
+ if ( !isset($browser_configuration['alias']) && !isset($browser_configuration['baseUrl']) ) {
+ $cache[$alias_name]['baseUrl'] = $this->Application->BaseURL();
+ }
+ }
+
+ self::$browserAliases = $cache;
+ }
+
+ return self::$browserAliases;
+ }
+
+}
Index: branches/5.2.x/core/tests/Unit/AbstractTestCase.php
===================================================================
--- branches/5.2.x/core/tests/Unit/AbstractTestCase.php
+++ branches/5.2.x/core/tests/Unit/AbstractTestCase.php
@@ -0,0 +1,51 @@
+<?php
+/**
+* @version $Id$
+* @package In-Portal
+* @copyright Copyright (C) 1997 - 2023 Intechnic. All rights reserved.
+* @license GNU/GPL
+* In-Portal is Open Source software.
+* This means that this software may have been modified pursuant
+* the GNU General Public License, and as distributed it includes
+* or is derivative of works licensed under the GNU General Public License
+* or other free or open source software licenses.
+* See http://www.in-portal.org/license for copyright notices and details.
+*/
+
+use PHPUnit\Framework\TestCase as BaseTestCase;
+
+abstract class AbstractTestCase extends BaseTestCase
+{
+
+ /**
+ * Reference to kApplication class instance.
+ *
+ * @var kApplication
+ */
+ protected $Application = null;
+
+ /**
+ * Connection to database
+ *
+ * @var IDBConnection
+ */
+ protected $Conn;
+
+ /**
+ * Constructs a test case with the given name.
+ *
+ * @param string $name Test case name.
+ * @param array $data Data.
+ * @param string $data_name Data name.
+ *
+ * @access public
+ */
+ public function __construct($name = null, array $data = array(), $data_name = '')
+ {
+ parent::__construct($name, $data, $data_name);
+
+ $this->Application =& kApplication::Instance();
+ $this->Conn =& $this->Application->GetADODBConnection();
+ }
+
+}
Index: branches/5.2.x/core/tests/Unit/kernel/utility/formatters/kFormatterTest.php
===================================================================
--- branches/5.2.x/core/tests/Unit/kernel/utility/formatters/kFormatterTest.php
+++ branches/5.2.x/core/tests/Unit/kernel/utility/formatters/kFormatterTest.php
@@ -0,0 +1,63 @@
+<?php
+
+
+final class kFormatterTest extends AbstractTestCase
+{
+
+ /**
+ * @dataProvider cutZerosDataProvider
+ */
+ public function testCutZeros($raw_number, $formatted_number, array $field_options)
+ {
+ $formatter = new kFormatter();
+
+ $item_prophecy = $this->prophesize('kDBItem');
+ $item_prophecy->GetFieldOptions('FieldName')->willReturn(array(
+ 'type' => 'float',
+ 'format' => '%01.6f',
+ ) + $field_options);
+ $item = $item_prophecy->reveal();
+
+ $this->assertSame($formatted_number, $formatter->Format($raw_number, 'FieldName', $item));
+ }
+
+ public function cutZerosDataProvider()
+ {
+ return array(
+ 'long' => array('12.345000', '12.345', array('cut_zeros' => 1)),
+ 'short' => array('12.300000', '12.3', array('cut_zeros' => 1)),
+ 'exact+leading_zero' => array('12.030000', '12.03', array('cut_zeros' => 1)),
+ 'very_long' => array('12.030050', '12.03005', array('cut_zeros' => 1)),
+ 'no_decimals' => array('12.000000', '12', array('cut_zeros' => 1)),
+ );
+ }
+
+ /**
+ * @dataProvider keepCentsDataProvider
+ */
+ public function testKeepCents($raw_number, $formatted_number, array $field_options)
+ {
+ $formatter = new kFormatter();
+
+ $item_prophecy = $this->prophesize('kDBItem');
+ $item_prophecy->GetFieldOptions('FieldName')->willReturn(array(
+ 'type' => 'float',
+ 'format' => '%01.6f',
+ ) + $field_options);
+ $item = $item_prophecy->reveal();
+
+ $this->assertSame($formatted_number, $formatter->Format($raw_number, 'FieldName', $item));
+ }
+
+ public function keepCentsDataProvider()
+ {
+ return array(
+ 'long' => array('12.345000', '12.345', array('keep_cents' => 2)),
+ 'short' => array('12.300000', '12.30', array('keep_cents' => 2)),
+ 'exact+leading_zero' => array('12.030000', '12.03', array('keep_cents' => 2)),
+ 'very_long' => array('12.030050', '12.03005', array('keep_cents' => 2)),
+ 'no_decimals' => array('12.000000', '12.00', array('keep_cents' => 2)),
+ );
+ }
+
+}
Index: branches/5.2.x/core/tests/kernel/utility/formatters/kFormatterTest.php
===================================================================
--- branches/5.2.x/core/tests/kernel/utility/formatters/kFormatterTest.php
+++ branches/5.2.x/core/tests/kernel/utility/formatters/kFormatterTest.php
@@ -1,63 +0,0 @@
-<?php
-
-
-final class kFormatterTest extends AbstractTestCase
-{
-
- /**
- * @dataProvider cutZerosDataProvider
- */
- public function testCutZeros($raw_number, $formatted_number, array $field_options)
- {
- $formatter = new kFormatter();
-
- $item_prophecy = $this->prophesize('kDBItem');
- $item_prophecy->GetFieldOptions('FieldName')->willReturn(array(
- 'type' => 'float',
- 'format' => '%01.6f',
- ) + $field_options);
- $item = $item_prophecy->reveal();
-
- $this->assertSame($formatted_number, $formatter->Format($raw_number, 'FieldName', $item));
- }
-
- public function cutZerosDataProvider()
- {
- return array(
- 'long' => array('12.345000', '12.345', array('cut_zeros' => 1)),
- 'short' => array('12.300000', '12.3', array('cut_zeros' => 1)),
- 'exact+leading_zero' => array('12.030000', '12.03', array('cut_zeros' => 1)),
- 'very_long' => array('12.030050', '12.03005', array('cut_zeros' => 1)),
- 'no_decimals' => array('12.000000', '12', array('cut_zeros' => 1)),
- );
- }
-
- /**
- * @dataProvider keepCentsDataProvider
- */
- public function testKeepCents($raw_number, $formatted_number, array $field_options)
- {
- $formatter = new kFormatter();
-
- $item_prophecy = $this->prophesize('kDBItem');
- $item_prophecy->GetFieldOptions('FieldName')->willReturn(array(
- 'type' => 'float',
- 'format' => '%01.6f',
- ) + $field_options);
- $item = $item_prophecy->reveal();
-
- $this->assertSame($formatted_number, $formatter->Format($raw_number, 'FieldName', $item));
- }
-
- public function keepCentsDataProvider()
- {
- return array(
- 'long' => array('12.345000', '12.345', array('keep_cents' => 2)),
- 'short' => array('12.300000', '12.30', array('keep_cents' => 2)),
- 'exact+leading_zero' => array('12.030000', '12.03', array('keep_cents' => 2)),
- 'very_long' => array('12.030050', '12.03005', array('keep_cents' => 2)),
- 'no_decimals' => array('12.000000', '12.00', array('keep_cents' => 2)),
- );
- }
-
-}
Index: branches/5.2.x/tools/build/build.properties.dist
===================================================================
--- branches/5.2.x/tools/build/build.properties.dist
+++ branches/5.2.x/tools/build/build.properties.dist
@@ -16,3 +16,5 @@
db.collation=
db.tableprefix=
db.charset=
+
+phpunit.testsuite=
Index: branches/5.2.x/tools/build/build_all.xml
===================================================================
--- branches/5.2.x/tools/build/build_all.xml
+++ branches/5.2.x/tools/build/build_all.xml
@@ -1,11 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="In-Portal (full)" default="build">
<property file="build.properties" />
+ <property name="phpunit.testsuite" value="" />
+
<resolvepath propertyName="base.dir" file="${base.dir}"/>
<property name="scan.dir" value="${base.dir}"/>
<property name="pdepend.exclude" value="blog,build,core/editor,core/ckeditor,core/units/general/libchart,modules/mpdf,system,vendor"/>
<property name="phpcpd.exclude" value="--exclude blog --exclude build --exclude core/editor --exclude core/ckeditor --exclude core/units/general/libchart --exclude modules/mpdf --exclude system --exclude vendor"/>
+ <property name="phpunit.config.file" value="${build.config.dir}/inc/phpunit.xml"/>
<import file="targets/common.xml"/>
Index: branches/5.2.x/tools/build/build_custom.xml
===================================================================
--- branches/5.2.x/tools/build/build_custom.xml
+++ branches/5.2.x/tools/build/build_custom.xml
@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="In-Portal (custom module only)" default="build">
<property file="build.properties" />
+ <property name="phpunit.testsuite" value="" />
+
<resolvepath propertyName="base.dir" file="${base.dir}"/>
<property name="scan.dir" value="${base.dir}/modules/custom"/>
@@ -8,6 +10,7 @@
<!--TODO: update tasks, that uses "pdepend.exclude" and "phpcpd.exclude" to handle empty exclusion list-->
<property name="pdepend.exclude" value="no-match"/>
<property name="phpcpd.exclude" value="--exclude no-match"/>
+ <property name="phpunit.config.file" value="${build.config.dir}/inc/custom_phpunit.xml"/>
<import file="targets/common.xml"/>
Index: branches/5.2.x/tools/build/inc/custom_phpunit.xml
===================================================================
--- branches/5.2.x/tools/build/inc/custom_phpunit.xml
+++ branches/5.2.x/tools/build/inc/custom_phpunit.xml
@@ -1,48 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit colors="true"
bootstrap="../../../core/kernel/tests/bootstrap.php"
+ cacheDirectory="../../../system/cache/phpunit"
+ cacheResultFile="../../../system/cache/.phpunit.result.cache"
beStrictAboutOutputDuringTests="true"
verbose="true">
+ <!--
+ - cacheDirectory - for PHPUnit 10+
+ - cacheResultFile - for PHPUnit 9
+ -->
+
<php>
<ini name="memory_limit" value="-1"/>
</php>
<testsuites>
- <testsuite name="all">
- <directory>../../../core/tests</directory>
- <directory>../../../modules/custom/tests</directory>
- <exclude>../../../core/tests/unit</exclude>
+ <testsuite name="Unit">
+ <directory>../../../modules/custom/tests/Unit</directory>
+ </testsuite>
+ <testsuite name="Functional">
+ <directory>../../../modules/custom/tests/Functional</directory>
</testsuite>
</testsuites>
- <logging>
- <!--<log type="coverage-html" target="../../../build/coverage" title="BankAccount"
- charset="UTF-8" yui="true" highlight="true"
- lowUpperBound="35" highLowerBound="70"/>
- <log type="coverage-clover" target="../../../build/logs/clover.xml"/>-->
- <log type="junit" target="../../../build/logs/junit.xml"/>
- <!--<log type="junit" target="../../../build/logs/junit.xml" logIncompleteSkipped="false"/>-->
- </logging>
-
<filter>
<!--<blacklist>
<directory suffix=".php">..</directory>
</blacklist>-->
- <whitelist addUncoveredFilesFromWhitelist="true">
+ <whitelist addUncoveredFilesFromWhitelist="false">
<directory suffix=".php">../../../modules/custom</directory>
<exclude>
- <directory>../../../blog</directory>
<directory>../../../modules/mpdf</directory>
- <directory>../../../core/editor</directory>
- <directory>../../../core/ckeditor</directory>
- <directory>../../../system</directory>
- <directory>../../../vendor</directory>
-
- <directory>../../../core/tests</directory>
<directory>../../../modules/*/tests</directory>
-
- <file>../../../core/kernel/tests/bootstrap.php</file>
</exclude>
</whitelist>
</filter>
Index: branches/5.2.x/tools/build/inc/phpunit.xml
===================================================================
--- branches/5.2.x/tools/build/inc/phpunit.xml
+++ branches/5.2.x/tools/build/inc/phpunit.xml
@@ -1,46 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit colors="true"
bootstrap="../../../core/kernel/tests/bootstrap.php"
+ cacheDirectory="../../../system/cache/phpunit"
+ cacheResultFile="../../../system/cache/.phpunit.result.cache"
beStrictAboutOutputDuringTests="true"
verbose="true">
+ <!--
+ - cacheDirectory - for PHPUnit 10+
+ - cacheResultFile - for PHPUnit 9
+ -->
+
<php>
<ini name="memory_limit" value="-1"/>
</php>
<testsuites>
- <testsuite name="all">
- <directory>../../../core/tests</directory>
- <directory>../../../modules/*/tests</directory>
- <exclude>../../../core/tests/unit</exclude>
+ <testsuite name="Unit">
+ <directory>../../../core/tests/Unit</directory>
+ <directory>../../../modules/*/tests/Unit</directory>
</testsuite>
- <testsuite name="custom">
- <directory>../../../modules/custom/tests</directory>
+ <testsuite name="Functional">
+ <directory>../../../core/tests/Functional</directory>
+ <directory>../../../modules/*/tests/Functional</directory>
</testsuite>
</testsuites>
- <logging>
- <!--<log type="coverage-html" target="../../../build/coverage" title="BankAccount"
- charset="UTF-8" yui="true" highlight="true"
- lowUpperBound="35" highLowerBound="70"/>
- <log type="coverage-clover" target="../../../build/logs/clover.xml"/>-->
- <log type="junit" target="../../../build/logs/junit.xml"/>
- <!--<log type="junit" target="../../../build/logs/junit.xml" logIncompleteSkipped="false"/>-->
- </logging>
-
<filter>
<!--<blacklist>
<directory suffix=".php">..</directory>
</blacklist>-->
- <whitelist addUncoveredFilesFromWhitelist="true">
- <directory suffix=".php">../../..</directory>
+ <whitelist addUncoveredFilesFromWhitelist="false">
+ <directory suffix=".php">../../../core/*</directory>
+ <directory suffix=".php">../../../modules/*</directory>
<exclude>
- <directory>../../../blog</directory>
<directory>../../../modules/mpdf</directory>
<directory>../../../core/editor</directory>
<directory>../../../core/ckeditor</directory>
- <directory>../../../system</directory>
- <directory>../../../vendor</directory>
<directory>../../../core/tests</directory>
<directory>../../../modules/*/tests</directory>
Index: branches/5.2.x/tools/build/targets/common.xml
===================================================================
--- branches/5.2.x/tools/build/targets/common.xml
+++ branches/5.2.x/tools/build/targets/common.xml
@@ -31,7 +31,7 @@
<target name="build" description="Builds a project" depends="init,verify,analyze"/>
- <target name="build-parallel" description="Builds a project (long targets executed in parallel)" depends="init,tools-parallel,phpunit"/>
+ <target name="build-parallel" description="Builds a project (long targets executed in parallel)" depends="init,tools-parallel,phpunit-ci"/>
<target name="tools-parallel" description="Run tools in parallel">
<parallel threadCount="2">
@@ -51,7 +51,7 @@
Make sure that our code is clean and functional. -->
<target name="verify" description="Verify code consistency" depends="init"/>
- <!--<target name="verify" description="Verify code consistency" depends="init,phpunit"/>-->
+ <!--<target name="verify" description="Verify code consistency" depends="init,phpunit-ci"/>-->
<!-- ### Analyze code
@@ -188,13 +188,62 @@
</phpdoc2>
</target>
- <target name="phpunit" description="Run tests with PHPUnit" depends="init">
- <exec executable="phpunit" logoutput="true" checkreturn="true">
- <arg value="--configuration"/>
- <arg path="${build.config.dir}/phpunit.xml"/>
- <arg value="--testsuite"/>
- <arg value="custom"/>
- </exec>
+ <target name="phpunit" description="Run tests with PHPUnit (print human-readable output)" depends="init">
+ <if>
+ <istrue value="${phpunit.testsuite}"/>
+ <then>
+ <exec executable="${php.binary}" checkreturn="true" passthru="true" dir="${base.dir}">
+ <arg value="${vendor.dir}/bin/phpunit"/>
+ <arg value="--configuration"/>
+ <arg path="${phpunit.config.file}"/>
+
+ <arg value="--testsuite"/>
+ <arg value="${phpunit.testsuite}"/>
+ </exec>
+ </then>
+ <else>
+ <exec executable="${php.binary}" checkreturn="true" passthru="true" dir="${base.dir}">
+ <arg value="${vendor.dir}/bin/phpunit"/>
+ <arg value="--configuration"/>
+ <arg path="${phpunit.config.file}"/>
+ </exec>
+ </else>
+ </if>
+ </target>
+
+ <target name="phpunit-ci" description="Run tests with PHPUnit (creates a log file for the CI server)" depends="init">
+ <if>
+ <istrue value="${phpunit.testsuite}"/>
+ <then>
+ <exec executable="${php.binary}" checkreturn="true" passthru="true" dir="${base.dir}">
+ <arg value="${vendor.dir}/bin/phpunit"/>
+ <arg value="--configuration"/>
+ <arg path="${phpunit.config.file}"/>
+
+ <arg value="--testsuite"/>
+ <arg value="${phpunit.testsuite}"/>
+
+ <arg path="--log-junit"/>
+ <arg path="${build.logs.dir}/junit.xml"/>
+
+ <arg path="--coverage-clover"/>
+ <arg path="${build.logs.dir}/clover.xml"/>
+ </exec>
+ </then>
+ <else>
+ <exec executable="${php.binary}" checkreturn="true" passthru="true" dir="${base.dir}">
+ <arg value="${vendor.dir}/bin/phpunit"/>
+ <arg value="--configuration"/>
+ <arg path="${phpunit.config.file}"/>
+
+ <arg path="--log-junit"/>
+ <arg path="${build.logs.dir}/junit.xml"/>
+
+ <arg path="--coverage-clover"/>
+ <arg path="${build.logs.dir}/clover.xml"/>
+ </exec>
+ </else>
+ </if>
</target>
<target name="init" depends="create-aliases,folders-create,deploy-ci" description="Prepare for build">

Event Timeline