From 3ec907386008ebd31ee88c44853368bdaeed6ae4 Mon Sep 17 00:00:00 2001 From: dyszczo <krzysztof@dyszczyk.pl> Date: Fri, 27 Apr 2018 11:28:09 +0200 Subject: [PATCH] apigen + integration --- apigen.neon | 27 +++++++++++++++++++++++++++ composer.json | 6 +++++- phpunit-integration.xml | 27 +++++++++++++++++++++++++++ tests/integration/bootstrap.php | 16 ++++++++++++++++ 4 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 apigen.neon create mode 100644 phpunit-integration.xml create mode 100644 tests/integration/bootstrap.php diff --git a/apigen.neon b/apigen.neon new file mode 100644 index 0000000..8004559 --- /dev/null +++ b/apigen.neon @@ -0,0 +1,27 @@ +destination: docs +templateConfig: /app/theme-woocommerce/config.neon +extensions: [php] +source: + - src +exclude: + - vendor + - tests + - languages + +charset: [UTF-8] +main: Wordpress plugin +title: Plugin template more info +baseUrl: "/" + +templateTheme: default +php: false +sourceCode: false +tree: true +deprecated: false +todo: false +download: false + +accessLevels: + - public + - private + - protected \ No newline at end of file diff --git a/composer.json b/composer.json index 95f8e78..0f7b8c9 100644 --- a/composer.json +++ b/composer.json @@ -27,6 +27,10 @@ "scripts": { "phpcs": "phpcs", "phpunit-unit": "phpunit --configuration phpunit-unit.xml --coverage-text --colors=never", - "phpunit-unit-fast": "phpunit --configuration phpunit-unit.xml --no-coverage" + "phpunit-unit-fast": "phpunit --configuration phpunit-unit.xml --no-coverage", + "phpunit-integration": "phpunit --configuration phpunit-integration.xml --coverage-text --colors=never", + "phpunit-integration-fast": "phpunit --configuration phpunit-integration.xml --no-coverage", + + "docs": "apigen generate" } } diff --git a/phpunit-integration.xml b/phpunit-integration.xml new file mode 100644 index 0000000..fe31963 --- /dev/null +++ b/phpunit-integration.xml @@ -0,0 +1,27 @@ +<phpunit bootstrap="tests/integration/bootstrap.php" + backupGlobals="false" + > + <testsuites> + <testsuite> + <directory prefix="test-" suffix=".php">./tests/integration</directory> + </testsuite> + </testsuites> + + <filter> + <whitelist> + <directory suffix=".php">classes</directory> + </whitelist> + </filter> + + <logging> + <log type="junit" target="build-coverage/report.junit.xml"/> + <log type="coverage-html" target="build-coverage/coverage" charset="UTF-8" yui="true" highlight="true"/> + <log type="coverage-text" target="build-coverage/coverage.txt"/> + <log type="coverage-clover" target="build-coverage/clover.xml"/> + </logging> + <php> + <env name="WP_DEVELOP_DIR" value="/tmp/wordpress-develop"/> + <env name="WC_DEVELOP_DIR" value="/tmp/woocommerce"/> + </php> + +</phpunit> \ No newline at end of file diff --git a/tests/integration/bootstrap.php b/tests/integration/bootstrap.php new file mode 100644 index 0000000..13777fc --- /dev/null +++ b/tests/integration/bootstrap.php @@ -0,0 +1,16 @@ +<?php +// disable xdebug backtrace +if ( function_exists( 'xdebug_disable' ) ) { + xdebug_disable(); +} + +if ( getenv( 'PLUGIN_PATH' ) !== false ) { + define( 'PLUGIN_PATH', getenv( 'PLUGIN_PATH' ) ); +} else { + define( 'PLUGIN_PATH', __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR ); +} + +require_once( getenv( 'WP_DEVELOP_DIR' ) . '/tests/phpunit/includes/functions.php' ); + +putenv('WP_TESTS_DIR=' . getenv( 'WP_DEVELOP_DIR' ) . '/tests/phpunit'); +require_once( getenv( 'WC_DEVELOP_DIR' ) . '/tests/bootstrap.php' ); -- GitLab