From 971caee29af10d5fd1b2e81ad58edb6ef4706172 Mon Sep 17 00:00:00 2001 From: Ken Rickard Date: Thu, 9 Feb 2023 11:09:10 -0500 Subject: [PATCH 1/4] See if we can run tests against our phing tasks. --- .gitignore | 1 + .the-build/build.yml | 61 ++++++++++++++++++++++++++++++++++++++++++++ build.xml | 46 +++++++++++++++++++++++++++++++++ run-tests.sh | 5 ++++ tests/.gitkeep | 0 5 files changed, 113 insertions(+) create mode 100644 .the-build/build.yml create mode 100644 build.xml create mode 100755 run-tests.sh create mode 100644 tests/.gitkeep diff --git a/.gitignore b/.gitignore index 0dca1458..b53fe74e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /vendor/ .idea +tests/*.txt \ No newline at end of file diff --git a/.the-build/build.yml b/.the-build/build.yml new file mode 100644 index 00000000..be8c9d5a --- /dev/null +++ b/.the-build/build.yml @@ -0,0 +1,61 @@ +# @file +# Default build configuration properties. +# +# This file may be customized for your project. The full set of default values can be +# found in the-build's repository. +# @see https://github.com/palantirnet/the-build/blob/release-2.0/defaults.yml + +projectname: the-build-test + +# These properties are used when building the settings.php and settings.yml for your +# Drupal site, and by some of the targets in the default build.xml file. +# @see .the-build/drupal/services.build.yml +# @see .the-build/drupal/settings.build.php +build: + host: acquia + +drupal: + root: docroot + + twig: + debug: true + + sites: + default: + # REQUIRED: Name of the sites subdirectory where the `settings.php` file + # should live. + dir: default + + # REQUIRED: Your site's URI; the default should be the URI of your local + # development environment. + uri: "localhost" + + # OPTIONAL: Drupal hash salt defaults to "temporary". + hash_salt: "12345" + + # OPTIONAL: The Drupal database name defaults to the site's "dir" value. + database: + database: "drupal" + + # Multisites created by `phing drupal-add-multisite` will be automatically added here. + # @multisite_placeholder@ + + # Defaults for all sites; these can be overridden for individual sites. + _defaults: + database: + username: "test" + password: "test" + host: "localhost" + +# Putting these flags in configuration allows you to vary the behat configuration per +# environment. Sometimes, there are tests that are appropriate to skip on CI. Compare +# these values to the defaults in build.circleci.yml. +behat: + args: "--suite=default --strict" + +# To build an artifact from your code, add the URL to your artifact git repository. +# @see https://github.com/palantirnet/the-build/blob/release-2.0/defaults.yml +# +# artifact: +# git: +# remote: diff --git a/build.xml b/build.xml new file mode 100644 index 00000000..3528abf9 --- /dev/null +++ b/build.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + Hello! I'm the-build. + + + Hi! I'm the-build. + + + + + + + + + + + + the-build test passed + + + --Expected-- + [${expected}] + + + + + + \ No newline at end of file diff --git a/run-tests.sh b/run-tests.sh new file mode 100755 index 00000000..9f93fd58 --- /dev/null +++ b/run-tests.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +test='the-build' +vendor/bin/phing -logfile "tests/$test.txt" $test +vendor/bin/phing run-tests \ No newline at end of file diff --git a/tests/.gitkeep b/tests/.gitkeep new file mode 100644 index 00000000..e69de29b From e431c98048e6ef8de6b5951361faa78cc768e7a4 Mon Sep 17 00:00:00 2001 From: Ken Rickard Date: Thu, 9 Feb 2023 11:10:19 -0500 Subject: [PATCH 2/4] Add test run to circle --- .circleci/config.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5ac76ad2..0329cedb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -51,6 +51,11 @@ jobs: echo "phpstan for tasks" vendor/bin/phpstan analyse src --level=2 + # Run internal tests + - run: + name: Test custom phing commands + command: ./run-tests.sh + # Install a drupal test project. - run: name: Create artifacts directory From 8a74b08cd87225e7175896848ff7935e6f197016 Mon Sep 17 00:00:00 2001 From: Ken Rickard Date: Thu, 9 Feb 2023 11:17:13 -0500 Subject: [PATCH 3/4] Remove test fail and see what happens --- build.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build.xml b/build.xml index 3528abf9..5e5efa18 100644 --- a/build.xml +++ b/build.xml @@ -20,9 +20,10 @@ Hello! I'm the-build. + From 732e1895a0acf0fc7502b356359bac2c556528d9 Mon Sep 17 00:00:00 2001 From: Ken Rickard Date: Thu, 9 Feb 2023 17:18:29 -0500 Subject: [PATCH 4/4] Try a set-site test case --- build.xml | 66 +++++++++++++++++++++++++++++++++++++++++++++------- run-tests.sh | 3 ++- 2 files changed, 60 insertions(+), 9 deletions(-) diff --git a/build.xml b/build.xml index 5e5efa18..6fd11e66 100644 --- a/build.xml +++ b/build.xml @@ -17,17 +17,12 @@ - - Hello! I'm the-build. - - + + + - @@ -44,4 +39,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + set-site test passed + + + + Checking ${prop_name} + + + + ${prop_name} test failed + --Expected-- + ${expected} + --Actual-- + ${actual} + + + + + \ No newline at end of file diff --git a/run-tests.sh b/run-tests.sh index 9f93fd58..cfdfae2a 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -1,5 +1,6 @@ #!/bin/bash +# Setup tests that read output before testing. test='the-build' vendor/bin/phing -logfile "tests/$test.txt" $test -vendor/bin/phing run-tests \ No newline at end of file +vendor/bin/phing run-tests