From e3bf90ea607aa19a5b769c5dd8caa4c923f1a242 Mon Sep 17 00:00:00 2001 From: Jared Whiklo Date: Tue, 12 Feb 2019 15:14:09 -0600 Subject: [PATCH] fix test runner and document travis scripts (#715) * fix test runner and document travis scripts * get viewers allows array or string * Alter PHPDoc for islandora_viewers_form() --- includes/solution_packs.inc | 6 +++--- tests/scripts/run_tests.sh | 2 +- tests/scripts/travis_scripts.sh | 7 +++++++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/includes/solution_packs.inc b/includes/solution_packs.inc index d813e067..d8ff3435 100644 --- a/includes/solution_packs.inc +++ b/includes/solution_packs.inc @@ -630,7 +630,7 @@ function islandora_check_object_status(AbstractObject $object_definition) { * * @param string $variable_id * The ID of the Drupal variable to save the viewer settings in. - * @param string $mimetype + * @param string|array $mimetype * The table will be populated with viewers supporting this mimetype. * @param string $model * The table will be populated with viewers supporting this content model. @@ -710,7 +710,7 @@ function islandora_viewers_form($variable_id = NULL, $mimetype = NULL, $model = * given, than any viewer that supports either the give $mimetype or $model will * be listed. * - * @param array $mimetype + * @param array|string $mimetype * List of mimetypes that the viewer supports. * @param string $content_model * Specify a content model to return only viewers that support the content @@ -719,7 +719,7 @@ function islandora_viewers_form($variable_id = NULL, $mimetype = NULL, $model = * @return array * Viewer definitions, or FALSE if none are found. */ -function islandora_get_viewers(array $mimetype = array(), $content_model = NULL) { +function islandora_get_viewers($mimetype = array(), $content_model = NULL) { $viewers = array(); $defined_viewers = module_invoke_all('islandora_viewer_info'); diff --git a/tests/scripts/run_tests.sh b/tests/scripts/run_tests.sh index dd8dda79..a48cddbe 100755 --- a/tests/scripts/run_tests.sh +++ b/tests/scripts/run_tests.sh @@ -2,4 +2,4 @@ # Wrapper for the test executing function so we only have to change it in one place. # The module name gets passed in as a command line arg. -php scripts/run-tests.sh --php `phpenv which php` --url http://localhost:8081 --verbose $1 +php scripts/run-tests.sh --php `phpenv which php` --url http://localhost:8081 --verbose "$1" diff --git a/tests/scripts/travis_scripts.sh b/tests/scripts/travis_scripts.sh index 6ed1487d..85fa9294 100755 --- a/tests/scripts/travis_scripts.sh +++ b/tests/scripts/travis_scripts.sh @@ -11,14 +11,17 @@ function checkReturn { } # Lint +echo "PHP Lint" find $TRAVIS_BUILD_DIR -type f \( -name '*.php' -o -name '*.inc' -o -name '*.module' -o -name '*.install' -o -name '*.test' \) -print0 | xargs -0 -n1 php -l checkReturn $? # Check line endings +echo "Check line endings" $ISLANDORA_DIR/tests/scripts/line_endings.sh $TRAVIS_BUILD_DIR checkReturn $? # Coding standards +echo "Drush coder-review" drush coder-review --reviews=production,security,style,i18n,potx $TRAVIS_BUILD_DIR checkReturn $? @@ -32,11 +35,15 @@ if [ "$(phpenv version-name)" != "5.3.3" ]; then else DRUPAL_SNIFFS="Drupal" fi + echo "PHP Codesniffer" /usr/bin/phpcs --standard=$DRUPAL_SNIFFS --extensions="php,module,inc,install,test" --ignore="vendor,*.info,*.txt,*.md" $TRAVIS_BUILD_DIR checkReturn $? +else + echo "Skipping PHP Codesniffer for PHP 5.3.3" fi # Copy/paste detection +echo "PHP Copy Paste Detection" phpcpd --names *.module,*.inc,*.test $TRAVIS_BUILD_DIR checkReturn $?