Browse Source

Merge pull request #5 from Islandora/7.x

update 7.x
pull/493/head
qadan 11 years ago
parent
commit
838f4ad043
  1. 13
      .travis.yml
  2. 7
      includes/authtokens.inc
  3. 39
      includes/derivatives.inc
  4. 18
      includes/solution_packs.inc
  5. 7
      islandora.api.php
  6. 1
      islandora.info
  7. 17
      islandora.module
  8. 41
      tests/README.md
  9. 277
      tests/datastream_validator_tests.test
  10. 988
      tests/datastream_validators.inc
  11. 66
      tests/islandora_web_test_case.inc
  12. 22
      tests/scripts/travis_after_failure.sh
  13. 16
      tests/scripts/travis_setup.sh

13
.travis.yml

@ -6,9 +6,14 @@ branches:
only:
- /^7.x/
env:
- FEDORA_VERSION="3.5"
- FEDORA_VERSION="3.6.2"
- FEDORA_VERSION="3.7.0"
matrix:
- FEDORA_VERSION="3.5"
- FEDORA_VERSION="3.6.2"
- FEDORA_VERSION="3.7.0"
global:
# This key is unique to the Islandora/islandora repository; logging will
# fail on forked repositories unless a new unique key is generated for them.
- secure: "nTv2Zb/qKlECK+xE5ahbfXI9ZZbf2ZMd796q7oPlTxUwvu6nomHnUOjJATl6tq2cj23PyJ89Jlgl5cMZ5h0QMUzYpN5hPyY6oCJxWgFamFaE3bv5E/rBd1f6WVTJW7S4UKn8Mr9R2PrX+ZxQZGVIigAfR8VfhQuP8PcuO5eMLBk="
before_install:
- export ISLANDORA_DIR=$TRAVIS_BUILD_DIR
- $TRAVIS_BUILD_DIR/tests/scripts/travis_setup.sh
@ -19,3 +24,5 @@ script:
- drush coder-review --reviews=production,security,style,i18n,potx,sniffer islandora
- phpcpd --names *.module,*.inc,*.test sites/all/modules/islandora
- drush test-run --uri=http://localhost:8081 Islandora
after_failure:
- $ISLANDORA_DIR/tests/scripts/travis_after_failure.sh

7
includes/authtokens.inc

@ -36,12 +36,7 @@ define('ISLANDORA_AUTHTOKEN_TOKEN_TIMEOUT', 300);
function islandora_get_object_token($pid, $dsid, $uses = 1) {
global $user;
$time = time();
// The function mt_rand is not considered cryptographically secure
// and openssl_rando_pseudo_bytes() is only available in PHP > 5.3.
// We might be safe in this case because mt_rand should never be using
// the same seed, but this is still more secure.
$token = hash("sha256", mt_rand() . $time);
$token = bin2hex(drupal_random_bytes(32));
$id = db_insert("islandora_authtokens")->fields(
array(
'token' => $token,

39
includes/derivatives.inc

@ -4,6 +4,45 @@
* Defines functions used when constructing derivatives.
*/
/**
* Decides which derivative function to call and runs it.
*
* @param AbstractObject $object
* The object to run the derivative function for.
* @param string $dsid
* The DSID to run the derivative function for.
*/
function islandora_run_derivatives(AbstractObject $object, $dsid) {
$batch_array = batch_get();
if (empty($batch_array)) {
$logging_results = islandora_do_derivatives($object, array(
'source_dsid' => $dsid,
));
islandora_derivative_logging($logging_results);
}
else {
batch_set(
// Title won't show for batch in a batch.
array(
'init_message' => t('Preparing derivatives for @label', array('@label' => $object->label)),
'error_message' => t('An error occured creating derivatives.'),
'progress_message' => t(
'Creating derivatives for @label <br/>Time elapsed: @elapsed <br/>
Estimated time remaining @estimate.',
array('@label' => $object->label)
),
'file' => drupal_get_path('module', 'islandora') . '/includes/regenerate_derivatives.form.inc',
'operations' => islandora_do_batch_derivatives(
$object,
array(
'source_dsid' => $dsid,
)
),
)
);
}
}
/**
* Kicks off derivative functions based upon hooks and conditions.
*

18
includes/solution_packs.inc

@ -256,7 +256,7 @@ function islandora_solution_pack_form_submit(array $form, array &$form_state) {
* the batch.
* @param array $not_checked
* The object that will bot be install.
*
*
* @return array
* An array defining a batch which can be passed on to batch_set().
*/
@ -367,7 +367,7 @@ function islandora_install_solution_pack($module, $op = 'install', $force = FALS
$t = get_t();
// Some general replacements.
$admin_link = l($t('Solution Pack admin'), 'admin/islandora/solution_packs');
$admin_link = l($t('Solution Pack admin'), 'admin/islandora/solution_pack_config');
$config_link = l($t('Islandora configuration'), 'admin/islandora/configure');
$t_params = array(
'@module' => $module,
@ -712,9 +712,8 @@ 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 string $mimetype
* Specify a mimetype to return only viewers that support this certain
* mimetype.
* @param array $mimetype
* List of mimetypes that the viewer supports.
* @param string $content_model
* Specify a content model to return only viewers that support the content
* model.
@ -722,14 +721,19 @@ function islandora_viewers_form($variable_id = NULL, $mimetype = NULL, $model =
* @return array
* Viewer definitions, or FALSE if none are found.
*/
function islandora_get_viewers($mimetype = NULL, $content_model = NULL) {
function islandora_get_viewers($mimetype = array(), $content_model = NULL) {
$viewers = array();
$defined_viewers = module_invoke_all('islandora_viewer_info');
if (!is_array($mimetype)) {
$mimetype = array($mimetype);
}
// Filter viewers by MIME type.
foreach ($defined_viewers as $key => $value) {
$value['mimetype'] = isset($value['mimetype']) ? $value['mimetype'] : array();
$value['model'] = isset($value['model']) ? $value['model'] : array();
if (in_array($mimetype, $value['mimetype']) OR in_array($content_model, $value['model'])) {
if (array_intersect($mimetype, $value['mimetype']) OR in_array($content_model, $value['model'])) {
$viewers[$key] = $value;
}
}

7
islandora.api.php

@ -627,9 +627,10 @@ function hook_CMODEL_PID_islandora_overview_object_alter(AbstractObject &$object
* - force: Bool denoting whether we are forcing the generation of
* derivatives.
* - source_dsid: (Optional) String of the datastream id we are generating
* from or NULL if it's the object itself.
* from or NULL if it's the object itself. Does not impact function
* ordering.
* - destination_dsid: (Optional) String of the datastream id that is being
* created. To be used in the UI.
* created. To be used in the UI. Does not impact function ordering.
* - weight: A string denoting the weight of the function. This value is
* sorted upon to run functions in order.
* - function: An array of function(s) to be ran when constructing
@ -642,7 +643,7 @@ function hook_CMODEL_PID_islandora_overview_object_alter(AbstractObject &$object
* following fields:
* - message: A string passed through t() describing the
* outcome of the operation.
* - message_sub: (Optional) Substitutions to be passed along to t() or
* - message_sub: (Optional) A substitution array as acceptable by t() or
* watchdog.
* - type: A string denoting whether the output is to be
* drupal_set_messaged (dsm) or watchdogged (watchdog).

1
islandora.info

@ -22,4 +22,5 @@ files[] = tests/islandora_manage_permissions.test
files[] = tests/datastream_versions.test
files[] = tests/datastream_cache.test
files[] = tests/derivatives.test
files[] = tests/datastream_validator_tests.test
php = 5.3

17
islandora.module

@ -123,11 +123,11 @@ function islandora_menu() {
'access arguments' => array('Islandora Viewers'),
'type' => MENU_NORMAL_ITEM,
);
$items['admin/islandora/islandora_utilities'] = array(
$items['admin/islandora/tools'] = array(
'title' => 'Islandora Utility Modules',
'description' => 'Configure Islandora utility modules.',
'access callback' => 'islandora_find_package',
'access arguments' => array('Islandora Utilities'),
'access arguments' => array('Islandora Tools'),
'type' => MENU_NORMAL_ITEM,
);
$items['admin/islandora/solution_pack_config/solution_packs'] = array(
@ -1722,10 +1722,7 @@ function islandora_islandora_basic_collection_get_query_filters() {
*/
function islandora_islandora_object_ingested(AbstractObject $object) {
module_load_include('inc', 'islandora', 'includes/derivatives');
$logging_results = islandora_do_derivatives($object, array(
'source_dsid' => NULL,
));
islandora_derivative_logging($logging_results);
islandora_run_derivatives($object, NULL);
}
/**
@ -1736,10 +1733,7 @@ function islandora_islandora_object_ingested(AbstractObject $object) {
*/
function islandora_islandora_datastream_ingested(AbstractObject $object, AbstractDatastream $datastream) {
module_load_include('inc', 'islandora', 'includes/derivatives');
$logging_results = islandora_do_derivatives($object, array(
'source_dsid' => $datastream->id,
));
islandora_derivative_logging($logging_results);
islandora_run_derivatives($object, $datastream->id);
}
/**
@ -1880,7 +1874,8 @@ function islandora_islandora_datastream_access($op, AbstractDatastream $datastre
$hooks = islandora_invoke_hook_list(ISLANDORA_DERVIATIVE_CREATION_HOOK, $object->models, array($object));
$hooks = islandora_filter_derivatives($hooks, array('force' => TRUE), $object);
foreach ($hooks as $hook) {
if ($hook['destination_dsid'] == $datastream->id && islandora_datastream_access(ISLANDORA_VIEW_OBJECTS, $object[$hook['source_dsid']], $user)) {
if ($hook['destination_dsid'] == $datastream->id &&
(is_null($hook['source_dsid']) || islandora_datastream_access(ISLANDORA_VIEW_OBJECTS, $object[$hook['source_dsid']], $user))) {
$applicable_hook = TRUE;
break;
}

41
tests/README.md

@ -1,4 +1,43 @@
You can define your own configurations specific to your enviroment by copying
OVERVIEW
********
You can define your own configurations specific to your environment by copying
default.test_config.ini to test_config.ini, making your changes in the copied
file. These test need write access to the system's $FEDORA_HOME/server/config
directory as well as the filter-drupal.xml file.
DATASTREAM VALIDATION TESTS
***************************
The datastream validator included in the Islandora testing suite is able to
generate tests procedurally based on the files in the folder
'fixtures/datastream_validator_files'. By default, this folder is empty.
The unit tests for the validator pull the name of the file (before the
extension) and use that to instantiate the correct ______DatastreamValidator
class to test that file against (e.g. Image.jpg spins up an instance of the
ImageDatastreamValidator class and checks the results).
You can test against multiple different encodings of the same filetype by giving
each file a different set of extensions, e.g. MP3.vbr.mp3 and MP3.sbr.mp3 both
test against the MP3 datastream validator, even though both are encoded
differently.
For classes that require the third parameter (e.g. the TextDatastreamValidator),
place an additional name.extension.ini file in the datastream_validator_files
folder (e.g. the Text.txt would be paired with Text.txt.ini). This .ini file
should be structured like a PHP .ini file (e.g. according to the format used by
http://php.net/parse_ini_file).The generated test will parse the .ini
file as an array and pass it on to the third parameter.
The following prefixes are currently available for use:
- Image (jpg, png, gif, and other filetypes recognized by PHPGD)
- TIFF
- JP2
- PDF
- Text (requires a configured .ini)
- WAV
- MP3
- MP4
- OGG (asserts OGG video; use an .ini with an 'audio' key to test audio only)
- MKV

277
tests/datastream_validator_tests.test

@ -0,0 +1,277 @@
<?php
/**
* @file
* Tests for things that test tests. Madness.
*/
include 'datastream_validators.inc';
/**
* A test DatastreamValidator for the DatastreamValidatorResultTestCase.
*/
class TestDatastreamValidator extends DatastreamValidator {
/**
* Assertion that adds a TRUE result.
*/
protected function assertSomethingSuccessfully() {
$this->addResult(TRUE, 'yay you did it', $this->getAssertionCall());
}
/**
* Assertion that adds a FALSE result.
*/
protected function assertSomethingFailed() {
$this->addResult(FALSE, 'boo you failed', $this->getAssertionCall());
}
}
/**
* Tests the ability of DatastreamValidators to produce correct results.
*/
class DatastreamValidatorResultTestCase extends IslandoraWebTestCase {
/**
* Returns the info for this test case.
*
* @see DrupalWebTestCase::getInfo()
*/
public static function getInfo() {
return array(
'name' => 'Datastream Validator Result Tests',
'description' => 'Unit tests for datastream validation result functionality.',
'group' => 'Islandora',
);
}
/**
* Sets up the test.
*
* @see DrupalWebTestCase::setUp()
*/
public function setUp() {
parent::setUp();
$user = $this->drupalCreateUser(array_keys(module_invoke_all('permission')));
$this->drupalLogin($user);
$object = $this->ingestConstructedObject();
$validator = new TestDatastreamValidator($object, 'DC');
$this->validator_results = $validator->getResults();
}
/**
* Generates a generic DatastreamValidatorResult and grabs its properties.
*/
public function testDatastreamValidatorResult() {
$result = new DatastreamValidatorResult(TRUE, 'true', array());
$this->assertEqual($result->getMessage(), 'true', "Result message generated correctly.", 'Islandora');
$this->assertEqual($result->getType(), TRUE, "Result type generated correctly.", 'Islandora');
$this->assertEqual($result->getCaller(), array(), "Result caller generated correctly.", 'Islandora');
}
/**
* Gets the results of TestDatastreamValidator and confirms only 2 exist.
*/
public function testTestDatastreamValidatorResultCount() {
$this->assertTrue(isset($this->validator_results[0]), "First of two expected results found.", 'Islandora');
$this->assertTrue(isset($this->validator_results[1]), "Second of two expected results found.", 'Islandora');
$this->assertFalse(isset($this->validator_results[2]), "No other unexpected results found.", 'Islandora');
}
/**
* Confirms the messages from TestDatastreamValidator.
*/
public function testTestDatastreamValidatorMessages() {
if (isset($this->validator_results[0]) && isset($this->validator_results[1])) {
$this->assertEqual($this->validator_results[0]->getMessage(), 'yay you did it', "Appropriate pass message returned.", 'Islandora');
$this->assertEqual($this->validator_results[1]->getMessage(), 'boo you failed', "Appropriate fail message returned.", 'Islandora');
}
}
/**
* Confirms the types from TestDatastreamValidator.
*/
public function testTestDatastreamValidatorTypes() {
if (isset($this->validator_results[0]) && isset($this->validator_results[1])) {
$this->assertEqual($this->validator_results[0]->getType(), TRUE, "Appropriate pass type of TRUE returned.", 'Islandora');
$this->assertEqual($this->validator_results[1]->getType(), FALSE, "Appropriate fail type of FALSE returned.", 'Islandora');
}
}
/**
* Confirms the useful information from TestDatastreamValidator.
*/
public function testTestDatastreamValidatorCallers() {
if (isset($this->validator_results[0]) && isset($this->validator_results[1])) {
// Grab the callers.
$first_caller = $this->validator_results[0]->getCaller();
$second_caller = $this->validator_results[1]->getCaller();
// Assert the 'file' key.
$this->assertTrue(substr($first_caller['file'], -48) === '/islandora/tests/datastream_validator_tests.test', "Appropriate pass caller file returned.", 'Islandora');
$this->assertTrue(substr($first_caller['file'], -48) === substr($second_caller['file'], -48), "Fail caller file matches the pass caller file.", 'Islandora');
$this->assertTrue($first_caller['function'] === 'TestDatastreamValidator->assertSomethingSuccessfully()', "Correct pass caller function returned (actual: {$first_caller['function']}; expected: TestDatastreamValidator->assertSomethingSuccessfully()).", 'Islandora');
$this->assertTrue($second_caller['function'] === 'TestDatastreamValidator->assertSomethingFailed()', "Correct fail caller function returned (actual: {$second_caller['function']}; expected: TestDatastreamValidator->assertSomethingFailed()).", 'Islandora');
$this->assertTrue($first_caller['line'] === 18, "Correct pass line number returned (actual: {$first_caller['line']}; expected: 9).", 'Islandora');
$this->assertTrue($second_caller['line'] === 25, "Correct fail line number returned (actual: {$second_caller['line']}; expected: 13).", 'Islandora');
}
}
}
/**
* Procedurally generated tests for DatastreamValidators.
*/
class PrefixDatastreamValidatorTestCase extends IslandoraWebTestCase {
/**
* The path to the datastream validator files.
*
* @var string
*/
protected $path;
/**
* Returns the info for this test case.
*
* @see DrupalWebTestCase::getInfo()
*/
public static function getInfo() {
return array(
'name' => 'Datastream File Validation Tests',
'description' => 'Tests each file in the islandora/tests/fixtures/datastream_validator_files folder against the appropriate DatastreamValidator class (see the README.md in the tests folder for details).',
'group' => 'Islandora',
);
}
/**
* Sets up the test.
*
* @see DrupalWebTestCase::setUp()
*/
public function setUp() {
parent::setUp();
$this->path = DRUPAL_ROOT . drupal_get_path('module', 'islandora') . "/tests/fixtures/datastream_validator_files/";
}
/**
* Confirms that a DatastreamValidator class exists for given filename.
*
* @param string $filename
* The file to grab the DatastreamValidator prefix from.
*
* @return bool
* TRUE if such a class exists; FALSE otherwise.
*/
protected function confirmValidatorClass($filename) {
$prefix = $this->getPrefix($filename);
if (!class_exists("{$prefix}DatastreamValidator")) {
$this->fail("No such DatastreamValidator exists for the prefix $prefix (filename: $filename).");
return FALSE;
}
return TRUE;
}
/**
* Confirms that a file exists at the given path.
*
* Bundled with lovely return values and fail messages.
*
* @param string $path
* The path to the file.
*
* @return bool
* TRUE if the file exists, FALSE otherwise.
*/
protected function confirmValidatorFile($path) {
if (!file_exists($path)) {
$this->fail("No such file exists at path $path.");
return FALSE;
}
return TRUE;
}
/**
* Gets the intended prefix from a filename.
*
* Uses the portion of the filename before the first period.
*
* @param string $filename
* The filename to get the prefix for.
*
* @return string
* The intended prefix.
*/
protected function getPrefix($filename) {
return array_shift(explode('.', $filename));
}
/**
* Create an object with a datastream generated from the given filename.
*
* @param string $filename
* The filename to use when adding a datastream.
*
* @return IslandoraFedoraObject
* The created object.
*/
protected function createObjectWithDatastream($filename) {
$prefix = $this->getPrefix($filename);
if (!$this->confirmValidatorClass($filename) && !$this->confirmValidatorFile($this->path . $filename)) {
return FALSE;
}
$datastreams = array(array(
'dsid' => $prefix,
'path' => $this->path . $filename,
'control_group' => 'M',
),
);
$object = $this->ingestConstructedObject(array(), $datastreams);
return $object;
}
/**
* Procedurally test each file in $this->path against a datastream validator.
*
* Check the README.md in this folder for details.
*/
public function testDatastreamValidators() {
// Grab everything in the validator files folder except for .ini files.
$files = array_intersect(glob("{$this->path}/*"), glob("{$this->path}/*.ini"));
foreach ($files as $file) {
$prefix = $this->getPrefix($file);
// If createObjectWithDatastream fails, we don't want to continue. We'll
// task it with returning fail messages rather than do so here.
$object = $this->createObjectWithDatastream($file);
if ($object !== FALSE) {
// Generate an appropriate validator.
$validator_name = "{$prefix}DatastreamValidator";
// If the file is paired with an .ini, use it as the third param.
if (file_exists("{$this->path}$file.ini")) {
$validator = new $validator_name($object, $prefix, parse_ini_file("{$this->path}$file.ini"));
}
else {
$validator = new $validator_name($object, $prefix);
}
// Get the results, check for fails.
$results = $validator->getResults();
$fails = FALSE;
foreach ($results as $result) {
if (!$result->getType()) {
$fails = TRUE;
$caller = $result->getCaller();
$this->fail("Failed to validate the test file $file against the assertion {$caller['function']}.");
}
}
// If there were no fails, say that the file passed validation.
if (!$fails) {
$this->pass("Test file $file validated successfully.");
}
}
}
}
}

988
tests/datastream_validators.inc

File diff suppressed because it is too large Load Diff

66
tests/islandora_web_test_case.inc

@ -216,37 +216,67 @@ class IslandoraWebTestCase extends DrupalWebTestCase {
/**
* Attempts to validate an array of datastreams, generally via binary checks.
*
* These functions exist in, and can be added to, datastream_validators.inc,
* which is found in this folder.
* Datastream validation classes exist in, and can be added to, the file
* 'datastream_validators.inc', which is found in this folder. Datastream
* validator classes use the naming convention 'PrefixDatastreamValidator',
* and that 'Prefix' is what this function uses to determine what class to
* instantiate.
*
* $param AbstractObject $object
* $param IslandoraFedoraObject $object
* The object to load datastreams from.
* $param array $datastreams
* An array of paired DSIDs, validate function names, and optional params.
* An array of arrays that pair DSIDs, DatastreamValidator class prefixes,
* and optional params. You can check some of the existing implementations
* for examples.
*/
public function validateDatastreams($object, array $datastreams) {
if (!is_object($object)) {
$this->fail("Failed. Object passed in is invalid.", 'Islandora');
$this->fail("Datastream validation failed; Object passed in is invalid.", 'Islandora');
return;
}
module_load_include('inc', 'islandora', 'tests/datastream_validators');
foreach ($datastreams as $datastream) {
if (isset($object[$datastream[0]])) {
$function = 'islandora_validate_' . $datastream[1] . '_datastream';
if (function_exists($function)) {
if (isset($datastream[2])) {
$results = $function($object, $datastream[0], $datastream[2]);
}
else {
$results = $function($object, $datastream[0]);
}
foreach ($results as $result) {
$this->assertTrue($result[0], $result[1], 'Islandora');
}
// Let's give them conventional names.
$dsid = $datastream[0];
$prefix = $datastream[1];
$params = array();
if (isset($datastream[2])) {
$params = $datastream[2];
}
// Legacy tests were created before the CamelCase conventions of the class
// system now in place. So, we need to automagically seek out prefixes
// that start with a lower-case letter and convert them to the proper
// format (rather than fixing every single legacy test).
if (ctype_lower(substr($prefix, 0, 1))) {
// Handle the case where the prefix is "image".
if ($prefix === 'image') {
$prefix = 'Image';
}
// Handle the case where the prefix is "text".
elseif ($prefix === 'text') {
$prefix = 'Text';
}
// All other cases involve just converting everything to caps.
else {
$this->fail("No {$datastream[0]} validation function exists for the {$datastream[1]} datastream.", 'Islandora');
$prefix = strtoupper($prefix);
}
}
// Instantiate the appropriate class, and grab the results.
$class_name = "{$prefix}DatastreamValidator";
if (class_exists($class_name)) {
$validator = new $class_name($object, $dsid, $params);
foreach ($validator->getResults() as $result) {
$this->assert($result->getType(), $result->getMessage(), 'Islandora', $result->getCaller());
}
}
else {
$this->fail("No DatastreamValidator class was found with the name '$class_name'; are you sure the prefix given to IslandoraWebTestCase->validateDatastreams() was entered correctly, or that such a validator exists?", 'Islandora');
}
}
}

22
tests/scripts/travis_after_failure.sh

@ -0,0 +1,22 @@
#!/bin/bash
# Get the end portion of the TRAVIS_REPO_SLUG for the branch name.
IFS=/ read -a DELIMITED_SLUG <<< "$TRAVIS_REPO_SLUG"
export CURRENT_REPO=${DELIMITED_SLUG[1]}
git config user.name --global islandora-logger
git config user.email --global noreply@islandora.ca
# Git business
export VERBOSE_DIR = $HOME/sites/default/files/simpletest/verbose
cd $HOME
git clone https://islandora-logger:$LOGGER_PW@github.com/Islandora/islandora_travis_logs.git
cd islandora_travis_logs
git checkout -B $CURRENT_REPO
# Out with the old, in with the new
git rm $HOME/islandora_travis_logs/*.*
cp $VERBOSE_DIR/*.* $HOME/islandora_travis_logs
git add -A
git commit -m "Job: $TRAVIS_JOB_NUMBER Commit: $TRAVIS_COMMIT"
git push origin $CURRENT_REPO

16
tests/scripts/travis_setup.sh

@ -12,14 +12,16 @@ export CATALINA_HOME='.'
export JAVA_OPTS="-Xms1024m -Xmx1024m -XX:MaxPermSize=512m -XX:+CMSClassUnloadingEnabled -Djavax.net.ssl.trustStore=$CATALINA_HOME/fedora/server/truststore -Djavax.net.ssl.trustStorePassword=tomcat"
./bin/startup.sh
cd $HOME
pear channel-discover pear.drush.org
pear upgrade --force Console_Getopt
pear upgrade --force pear
pear channel-discover pear.drush.org
pear channel-discover pear.drush.org
pear channel-discover pear.phpqatools.org
pear channel-discover pear.netpirates.net
pear install pear/PHP_CodeSniffer
pear install pear.phpunit.de/phpcpd
# "prefer-source" required due to SSL shenanigans on the Travis boxes...
composer global require --prefer-source 'squizlabs/php_codesniffer=*' 'sebastian/phpcpd=*'
# Because we can't add to the PATH here and this file is used in many repos,
# let's just throw symlinks in.
find $HOME/.composer/vendor/bin -executable \! -type d -exec sudo ln -s {} /usr/local/sbin/ \;
# Install Drush
git clone https://github.com/drush-ops/drush.git
@ -33,6 +35,10 @@ phpenv rehash
drush dl --yes drupal
cd drupal-*
drush si minimal --db-url=mysql://drupal:drupal@localhost/drupal --yes
# Needs to make things from Composer be available (PHP CS, primarily)
sudo chmod a+w sites/default/settings.php
echo "include_once '$HOME/.composer/vendor/autoload.php';" >> sites/default/settings.php
sudo chmod a-w sites/default/settings.php
drush runserver --php-cgi=$HOME/.phpenv/shims/php-cgi localhost:8081 &>/dev/null &
ln -s $ISLANDORA_DIR sites/all/modules/islandora
mv sites/all/modules/islandora/tests/travis.test_config.ini sites/all/modules/islandora/tests/test_config.ini

Loading…
Cancel
Save