diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5919f63bf46d195b114b646fa938db1ebc1cc3bc..b028a19ae16f509bd889914bdc363bfcd5f0e1b9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,4 @@ -#1.10.5 +#1.10.8 before_script: - cd ${CI_PROJECT_DIR} @@ -36,8 +36,35 @@ stages: script: - ls -l - php --version + - if [[ -f tests/integration/prepare.sh ]]; then sh tests/integration/prepare.sh; fi - composer phpunit-integration +.template: &job-test-unit-template + <<: *job-test-template + script: + - ls -l + - php --version + - composer phpunit-unit + +.template: &job-test-integration-oldphp-template + <<: *job-test-integration-template + script: + - ls -l + - php --version + - composer update --no-progress + - if [[ -f tests/integration/prepare.sh ]]; then sh tests/integration/prepare.sh; fi + - composer phpunit-integration + +.template: &job-deploy-template + image: wpdesknet/amazon-svn-deploy + stage: deploy + dependencies: + - build to deploy + retry: 2 + when: manual + only: + - tags + build php: image: wpdesknet/phpunit-woocommerce:0-0 stage: build @@ -60,38 +87,30 @@ code style test: - composer phpcs unit test 0: - <<: *job-test-template - image: wpdesknet/phpunit-woocommerce:0-0 - script: - - ls -l - - php --version - - composer phpunit-unit + <<: *job-test-unit-template -integration test 0-0: +integration test lastest: <<: *job-test-integration-template - image: wpdesknet/phpunit-woocommerce:0-0 -integration test 1-1: +integration test php7-1 wc-1: <<: *job-test-integration-template image: wpdesknet/phpunit-woocommerce:1-1 -integration test 2-2: +integration test php7 wc-2: <<: *job-test-integration-template image: wpdesknet/phpunit-woocommerce:2-2 -integration test 3-3: +integration test php-7 wc-3: <<: *job-test-integration-template - image: wpdesknet/phpunit-woocommerce:3-3 - script: - - php --version - - phpunit --configuration phpunit-integration.xml + image: wpdesknet/phpunit-woocommerce:2-3 -integration test 4-3: - <<: *job-test-integration-template - image: wpdesknet/phpunit-woocommerce:4-3 - script: - - php --version - - phpunit --configuration phpunit-integration.xml +integration test php5-6: + <<: *job-test-integration-oldphp-template + image: wpdesknet/phpunit-woocommerce:3-0 + +integration test php5-5: + <<: *job-test-integration-oldphp-template + image: wpdesknet/phpunit-woocommerce:4-0 apigen docs: image: @@ -107,23 +126,24 @@ apigen docs: - /app/vendor/bin/apigen generate - php /app/hooks-docs.php ${CI_PROJECT_DIR} only: - - master + - tags pages: stage: deploy dependencies: - apigen docs script: + - rm -rf public - mv docs/ public/ artifacts: expire_in: 1 day paths: - public only: - - master + - tags build to deploy: - image: wpdesknet/phpunit-woocommerce:0-0 + image: wpdesknet/phpunit-woocommerce:4-0 stage: pre-deploy artifacts: expire_in: 1 month @@ -134,14 +154,14 @@ build to deploy: script: - php --version - ls -l + - /tmp/set_version.sh ${CI_COMMIT_REF_NAME} - rm -rf ${CI_PROJECT_DIR}/release ${CI_PROJECT_DIR}/release.zip /tmp/release - mkdir /tmp/release - - mkdir ${CI_PROJECT_DIR}/release - - mkdir ${CI_PROJECT_DIR}/release/${CI_PROJECT_NAME} + - mkdir -p ${CI_PROJECT_DIR}/release/${CI_PROJECT_NAME} - cp -rf ${CI_PROJECT_DIR}/* /tmp/release - cp -rf /tmp/release/* ${CI_PROJECT_DIR}/release/${CI_PROJECT_NAME} - cd ${CI_PROJECT_DIR}/release/${CI_PROJECT_NAME} -# - composer install --no-dev --no-progress + - composer install --no-dev --no-progress - rm -rf build-coverage release tests docs .git .editorconfig .gitignore .gitlab-ci.yml apigen.neon \ composer.json composer.lock phpcs.xml.dist phpunit-integration.xml phpunit-unit.xml composer.phar wp-cli.phar - cd ../ @@ -150,37 +170,30 @@ build to deploy: - tags deploy to shop: - image: wpdesknet/amazon-svn-deploy - stage: deploy - dependencies: - - build to deploy - retry: 2 + <<: *job-deploy-template script: - - ls -l - /tmp/deploy_shop.sh ${CI_PROJECT_NAME} release.zip ${CI_PROJECT_NAME}.zip - 'curl -X POST --data-urlencode "payload={\"text\": \"Projekt <https://gitlab.com/wpdesk/${CI_PROJECT_NAME}|${CI_PROJECT_NAME}> zdeployowany do sklepu w wersji ${CI_COMMIT_REF_NAME}\", }" https://hooks.slack.com/services/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' - only: - - tags environment: name: wpdesk shop url: https://wpdeskplugin.s3.amazonaws.com/${CI_PROJECT_NAME}.zip - when: manual + +deploy to demo: + <<: *job-deploy-template + script: + - /tmp/deploy_demo.sh release/${CI_PROJECT_NAME} ${CI_PROJECT_NAME} + - 'curl -X POST --data-urlencode "payload={\"text\": \"Projekt <https://gitlab.com/wpdesk/${CI_PROJECT_NAME}|${CI_PROJECT_NAME}> zdeployowany do demo w wersji ${CI_COMMIT_REF_NAME}\", }" https://hooks.slack.com/services/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' + environment: + name: wpdesk demo + url: https://demo.wpdesk.org deploy to repository: - image: wpdesknet/amazon-svn-deploy - stage: deploy - dependencies: - - build to deploy - retry: 2 + <<: *job-deploy-template script: - - ls -l - rm -rf /tmp/svn-repository - mkdir /tmp/svn-repository - /tmp/deploy_repository.sh ${CI_PROJECT_NAME} release/${CI_PROJECT_NAME} /tmp/svn-repository - 'curl -X POST --data-urlencode "payload={\"text\": \"Projekt <https://gitlab.com/wpdesk/${CI_PROJECT_NAME}|${CI_PROJECT_NAME}> zdeployowany do repozytorium WP w wersji ${CI_COMMIT_REF_NAME}\", }" https://hooks.slack.com/services/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' - only: - - tags environment: name: wordpress repository url: https://downloads.wordpress.org/plugin/${CI_PROJECT_NAME}.${CI_COMMIT_REF_NAME}.zip - when: manual \ No newline at end of file diff --git a/classes/wpdesk/interface-plugin-factory.php b/classes/wpdesk/interface-plugin-factory.php index 7f0002bbcda16560e47a5c992b4f1723b49e4354..1b2b2722711718f9095661c640ab30ee8c8fef31 100644 --- a/classes/wpdesk/interface-plugin-factory.php +++ b/classes/wpdesk/interface-plugin-factory.php @@ -4,9 +4,12 @@ if ( ! defined( 'ABSPATH' ) ) { exit; } // Exit if accessed directly -interface WPDesk_Plugin_Factory_1_10 { - const WPDESK_FILTER_PLUGIN_CLASS = 'wpdesk_plugin_class'; +if ( !interface_exists( 'WPDesk_Plugin_Factory_1_10' ) ) { + interface WPDesk_Plugin_Factory_1_10 { + const WPDESK_FILTER_PLUGIN_CLASS = 'wpdesk_plugin_class'; - static function build_plugin(); - static function get_plugin_instance(); + static function build_plugin(); + + static function get_plugin_instance(); + } } \ No newline at end of file diff --git a/composer.json b/composer.json index 644bbe75bc9a5361c76f3a9393492266d1f8fdee..aea5e03612042bead22f8d854726445713f86a36 100644 --- a/composer.json +++ b/composer.json @@ -10,17 +10,14 @@ "php": ">=5.5" }, "require-dev": { - "phpunit/phpunit": "^6", + "phpunit/phpunit": "*", "wp-coding-standards/wpcs": "^0.14.1", "squizlabs/php_codesniffer": "^3.0.2", - "mockery/mockery": "^1.0", - "10up/wp_mock": "^0.3", + "mockery/mockery": "*", + "10up/wp_mock": "*", "wimg/php-compatibility": "^8" }, "autoload-dev": { - "psr-4": { - "JpkTest\\": "tests" - } }, "scripts": { "test": "echo composer is alive",