Browse Source

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()
pull/716/head
Jared Whiklo 6 years ago committed by Jonathan Green
parent
commit
e3bf90ea60
  1. 6
      includes/solution_packs.inc
  2. 2
      tests/scripts/run_tests.sh
  3. 7
      tests/scripts/travis_scripts.sh

6
includes/solution_packs.inc

@ -630,7 +630,7 @@ function islandora_check_object_status(AbstractObject $object_definition) {
* *
* @param string $variable_id * @param string $variable_id
* The ID of the Drupal variable to save the viewer settings in. * 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. * The table will be populated with viewers supporting this mimetype.
* @param string $model * @param string $model
* The table will be populated with viewers supporting this content 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 * given, than any viewer that supports either the give $mimetype or $model will
* be listed. * be listed.
* *
* @param array $mimetype * @param array|string $mimetype
* List of mimetypes that the viewer supports. * List of mimetypes that the viewer supports.
* @param string $content_model * @param string $content_model
* Specify a content model to return only viewers that support the content * 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 * @return array
* Viewer definitions, or FALSE if none are found. * 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(); $viewers = array();
$defined_viewers = module_invoke_all('islandora_viewer_info'); $defined_viewers = module_invoke_all('islandora_viewer_info');

2
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. # 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. # 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"

7
tests/scripts/travis_scripts.sh

@ -11,14 +11,17 @@ function checkReturn {
} }
# Lint # 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 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 $? checkReturn $?
# Check line endings # Check line endings
echo "Check line endings"
$ISLANDORA_DIR/tests/scripts/line_endings.sh $TRAVIS_BUILD_DIR $ISLANDORA_DIR/tests/scripts/line_endings.sh $TRAVIS_BUILD_DIR
checkReturn $? checkReturn $?
# Coding standards # Coding standards
echo "Drush coder-review"
drush coder-review --reviews=production,security,style,i18n,potx $TRAVIS_BUILD_DIR drush coder-review --reviews=production,security,style,i18n,potx $TRAVIS_BUILD_DIR
checkReturn $? checkReturn $?
@ -32,11 +35,15 @@ if [ "$(phpenv version-name)" != "5.3.3" ]; then
else else
DRUPAL_SNIFFS="Drupal" DRUPAL_SNIFFS="Drupal"
fi fi
echo "PHP Codesniffer"
/usr/bin/phpcs --standard=$DRUPAL_SNIFFS --extensions="php,module,inc,install,test" --ignore="vendor,*.info,*.txt,*.md" $TRAVIS_BUILD_DIR /usr/bin/phpcs --standard=$DRUPAL_SNIFFS --extensions="php,module,inc,install,test" --ignore="vendor,*.info,*.txt,*.md" $TRAVIS_BUILD_DIR
checkReturn $? checkReturn $?
else
echo "Skipping PHP Codesniffer for PHP 5.3.3"
fi fi
# Copy/paste detection # Copy/paste detection
echo "PHP Copy Paste Detection"
phpcpd --names *.module,*.inc,*.test $TRAVIS_BUILD_DIR phpcpd --names *.module,*.inc,*.test $TRAVIS_BUILD_DIR
checkReturn $? checkReturn $?

Loading…
Cancel
Save