diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..e043b79d --- /dev/null +++ b/.travis.yml @@ -0,0 +1,39 @@ +sudo: true +language: php +php: + - 5.5 + - 5.6 + - 7.0 + - hhvm + +matrix: + allow_failures: + - php: hhvm + fast_finish: true + +branches: + only: + - /^8.x/ + + +before_install: + - export ISLANDORA_DIR=$TRAVIS_BUILD_DIR + +install: +# - $TRAVIS_BUILD_DIR/tests/scripts/travis_setup.sh + - composer install + - php vendor/bin/phpcs --config-set installed_paths vendor/drupal/coder/coder_sniffer + + +script: + - $ISLANDORA_DIR/tests/scripts/line_endings.sh . + - php vendor/bin/phpcs --standard=Drupal *.module src + - php vendor/bin/phpcpd --names *.module,*.inc,*.test,*.php --exclude=vendor . + +notifications: + irc: + channels: + - "irc.freenode.org#islandora" + on_success: change + on_failure: always + skip_join: true diff --git a/composer.json b/composer.json new file mode 100644 index 00000000..4feebf4a --- /dev/null +++ b/composer.json @@ -0,0 +1,34 @@ +{ + "name": "drupal/islandora", + "description": "A client for interacting with a Fedora 4 server using CLAW microservices.", + "type": "drupal-module", + "homepage": "https://github.com/islandora-claw/islandora", + "support": { + "issues": "https://github.com/islandora-claw/CLAW/issues", + "irc": "irc://irc.freenode.net/islandora" + }, + "require-dev": { + "phpunit/phpunit": "^4.8", + "drupal/coder": "*", + "sebastian/phpcpd": "*" + }, + "license": "GPL-2.0+", + "authors": [ + { + "name": "Islandora Foundation", + "email": "community@islandora.ca", + "role": "Owner" + + }, + { + "name": "Daniel Lamb", + "email": "dlamb@islandora.ca", + "role": "Maintainer" + }, + { + "name": "Diego Pino", + "email": "dpino@krayon.cl", + "role": "Maintainer" + } + ] +} \ No newline at end of file diff --git a/fedora_resource.page.inc b/fedora_resource.page.inc index 5b8171e6..92d5855c 100644 --- a/fedora_resource.page.inc +++ b/fedora_resource.page.inc @@ -14,8 +14,8 @@ * file that was distributed with this source code. * * @author Diego Pino Navarro https://github.com/diegopino - * */ + use Drupal\Core\Render\Element; use Drupal\Core\Link; use Drupal\Core\Url; @@ -41,16 +41,16 @@ function template_preprocess_fedora_resource(array &$variables) { } /** -* Prepares variables for a custom entity type creation list templates. -* -* Default template: fedora_resource-content-add-list.html.twig. -* -* @param array $variables -* An associative array containing: -* - content: An array of fedora_resource-types. -* -* @see block_content_add_page() -*/ + * Prepares variables for a custom entity type creation list templates. + * + * Default template: fedora_resource-content-add-list.html.twig. + * + * @param array $variables + * An associative array containing: + * - content: An array of fedora_resource-types. + * + * @see block_content_add_page() + */ function template_preprocess_fedora_resource_content_add_list(&$variables) { $variables['types'] = array(); $query = \Drupal::request()->query->all(); @@ -60,11 +60,11 @@ function template_preprocess_fedora_resource_content_add_list(&$variables) { 'fedora_resource_type' => $type->id(), ), array('query' => $query))), 'description' => array( - '#markup' => $type->label(), + '#markup' => $type->label(), ), 'title' => $type->label(), 'localized_options' => array( - 'query' => $query, + 'query' => $query, ), ); } diff --git a/islandora.module b/islandora.module index 39f3ff18..ac28cddc 100644 --- a/islandora.module +++ b/islandora.module @@ -25,7 +25,7 @@ function islandora_help($route_name, RouteMatchInterface $route_match) { case 'help.page.islandora': $output = ''; $output .= '

' . t('About') . '

'; - $output .= '

' . t('') . '

'; + $output .= '

' . t('This is a placeholder for future help text about Islandora.') . '

'; return $output; default: @@ -51,8 +51,8 @@ function islandora_theme() { } /** -* Implements hook_theme_suggestions_HOOK(). -*/ + * Implements hook_theme_suggestions_HOOK(). + */ function islandora_theme_suggestions_fedora_resource(array $variables) { $suggestions = array(); $entity = $variables['elements']['#fedora_resource']; @@ -81,4 +81,4 @@ function islandora_rdf_namespaces() { 'ore' => 'http://www.openarchives.org/ore/terms/', 'rdf' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#', ); -} \ No newline at end of file +} diff --git a/src/Controller/FedoraResourceAddController.php b/src/Controller/FedoraResourceAddController.php index 700f3aba..738424ff 100644 --- a/src/Controller/FedoraResourceAddController.php +++ b/src/Controller/FedoraResourceAddController.php @@ -4,13 +4,11 @@ namespace Drupal\islandora\Controller; use Drupal\Core\Controller\ControllerBase; use Drupal\Core\Entity\EntityInterface; -use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Url; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\Request; - /** * Class FedoraResourceAddController. * @@ -18,80 +16,104 @@ use Symfony\Component\HttpFoundation\Request; */ class FedoraResourceAddController extends ControllerBase { - public function __construct(EntityStorageInterface $storage, EntityStorageInterface $type_storage) { - $this->storage = $storage; - $this->typeStorage = $type_storage; - } + /** + * The Entity storage. + * + * @var \Drupal\Core\Entity\EntityStorageInterface + */ + protected $storage; - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container) { - /** @var EntityTypeManagerInterface $entity_type_manager */ - $entity_type_manager = $container->get('entity_type.manager'); - return new static( - $entity_type_manager->getStorage('fedora_resource'), - $entity_type_manager->getStorage('fedora_resource_type') - ); - } - /** - * Displays add links for available bundles/types for entity fedora_resource . - * - * @param \Symfony\Component\HttpFoundation\Request $request - * The current request object. - * - * @return array - * A render array for a list of the fedora_resource bundles/types that can be added or - * if there is only one type/bunlde defined for the site, the function returns the add page for that bundle/type. - */ - public function add(Request $request) { - $types = $this->typeStorage->loadMultiple(); - if ($types && count($types) == 1) { - $type = reset($types); - return $this->addForm($type, $request); - } - if (count($types) === 0) { - return array( - '#markup' => $this->t('You have not created any %bundle types yet. @link to add a new type.', [ - '%bundle' => 'Fedora resource', - '@link' => $this->l($this->t('Go to the type creation page'), Url::fromRoute('entity.fedora_resource_type.add_form')), - ]), - ); - } - return array('#theme' => 'fedora_resource_content_add_list', '#content' => $types); - } + /** + * The Entity storage type. + * + * @var \Drupal\Core\Entity\EntityStorageInterface + */ + protected $typeStorage; - /** - * Presents the creation form for fedora_resource entities of given bundle/type. - * - * @param EntityInterface $fedora_resource_type - * The custom bundle to add. - * @param \Symfony\Component\HttpFoundation\Request $request - * The current request object. - * - * @return array - * A form array as expected by drupal_render(). - */ - public function addForm(EntityInterface $fedora_resource_type, Request $request) { - $entity = $this->storage->create(array( - 'type' => $fedora_resource_type->id() - )); - return $this->entityFormBuilder()->getForm($entity); - } + /** + * FedoraResourceAddController constructor. + * + * @param \Drupal\Core\Entity\EntityStorageInterface $storage + * The Entity storage. + * @param \Drupal\Core\Entity\EntityStorageInterface $type_storage + * The Entity storage type. + */ + public function __construct(EntityStorageInterface $storage, EntityStorageInterface $type_storage) { + $this->storage = $storage; + $this->typeStorage = $type_storage; + } + + /** + * {@inheritdoc} + */ + public static function create(ContainerInterface $container) { + /** @var EntityTypeManagerInterface $entity_type_manager */ + $entity_type_manager = $container->get('entity_type.manager'); + return new static( + $entity_type_manager->getStorage('fedora_resource'), + $entity_type_manager->getStorage('fedora_resource_type') + ); + } - /** - * Provides the page title for this controller. - * - * @param EntityInterface $fedora_resource_type - * The custom bundle/type being added. - * - * @return string - * The page title. - */ - public function getAddFormTitle(EntityInterface $fedora_resource_type) { - return t('Create of bundle @label', - array('@label' => $fedora_resource_type->label()) + /** + * Displays add links for available bundles/types for entity fedora_resource. + * + * @param \Symfony\Component\HttpFoundation\Request $request + * The current request object. + * + * @return array + * A render array for a list of the fedora_resource bundles/types that can + * be added or if there is only one type/bunlde defined for the site, the + * function returns the add page for that bundle/type. + */ + public function add(Request $request) { + $types = $this->typeStorage->loadMultiple(); + if ($types && count($types) == 1) { + $type = reset($types); + return $this->addForm($type, $request); + } + if (count($types) === 0) { + return array( + '#markup' => $this->t('You have not created any %bundle types yet. @link to add a new type.', [ + '%bundle' => 'Fedora resource', + '@link' => $this->l($this->t('Go to the type creation page'), Url::fromRoute('entity.fedora_resource_type.add_form')), + ]), ); } + return array('#theme' => 'fedora_resource_content_add_list', '#content' => $types); + } + + /** + * Presents the creation form for fedora_resource entities of given type. + * + * @param EntityInterface $fedora_resource_type + * The custom bundle to add. + * @param \Symfony\Component\HttpFoundation\Request $request + * The current request object. + * + * @return array + * A form array as expected by drupal_render(). + */ + public function addForm(EntityInterface $fedora_resource_type, Request $request) { + $entity = $this->storage->create(array( + 'type' => $fedora_resource_type->id(), + )); + return $this->entityFormBuilder()->getForm($entity); + } + + /** + * Provides the page title for this controller. + * + * @param EntityInterface $fedora_resource_type + * The custom bundle/type being added. + * + * @return string + * The page title. + */ + public function getAddFormTitle(EntityInterface $fedora_resource_type) { + return t('Create of bundle @label', + array('@label' => $fedora_resource_type->label()) + ); + } } diff --git a/src/Entity/FedoraResource.php b/src/Entity/FedoraResource.php index 0b2d93f8..7ae84542 100644 --- a/src/Entity/FedoraResource.php +++ b/src/Entity/FedoraResource.php @@ -65,18 +65,28 @@ use Drupal\user\UserInterface; * field_ui_base_route = "entity.fedora_resource_type.edit_form" * ) */ -class FedoraResource extends ContentEntityBase implements FedoraResourceInterface{ +class FedoraResource extends ContentEntityBase implements FedoraResourceInterface { use EntityChangedTrait; /** + * Override this to have a rel ='uuid' for islandora entities. + * + * Stolen (but not inherited from EntityInterface) + * * @param string $rel + * The link relationship type, for example: canonical or edit-form. * @param array $options - * @return $this|\Drupal\Core\Url + * See \Drupal\Core\Routing\UrlGeneratorInterface::generateFromRoute() for + * the available options. + * + * @return \Drupal\Core\Url + * The URL object. */ public function toUrl($rel = 'canonical', array $options = []) { // TODO: I Will override this to have a rel ='uuid' for islandora entities - return parent::toUrl($rel, $options); // TODO: Change the autogenerated stub + // TODO: Change the autogenerated stub. + return parent::toUrl($rel, $options); } /** @@ -92,7 +102,8 @@ class FedoraResource extends ContentEntityBase implements FedoraResourceInterfac * An array of URI placeholders. */ protected function urlRouteParameters($rel) { - $uri_route_parameters = parent::urlRouteParameters($rel); // TODO: Change the autogenerated stub + // TODO: Change the autogenerated stub. + $uri_route_parameters = parent::urlRouteParameters($rel); if ($rel === 'uuid') { $uri_route_parameters[$this->getEntityTypeId()] = $this->uuid(); } @@ -100,7 +111,6 @@ class FedoraResource extends ContentEntityBase implements FedoraResourceInterfac } - /** * {@inheritdoc} */ @@ -118,8 +128,8 @@ class FedoraResource extends ContentEntityBase implements FedoraResourceInterfac parent::postSave($storage, $update); // Reindex the entity when it is updated. The entity is automatically - // indexed when it is added, simply by being added to the {fedora_resource} table. - // Only required if using the core search index. + // indexed when it is added, simply by being added to the {fedora_resource} + // table. Only required if using the core search index. if ($update) { if (\Drupal::moduleHandler()->moduleExists('search')) { search_mark_for_reindex('fedora_resource_search', $this->id()); @@ -208,32 +218,32 @@ class FedoraResource extends ContentEntityBase implements FedoraResourceInterfac $this->set('status', $published ? NODE_PUBLISHED : NODE_NOT_PUBLISHED); return $this; } + /** * {@inheritdoc} */ - public function hasParent() - { - return ($this->get('fedora_has_parent') !== null); + public function hasParent() { + return ($this->get('fedora_has_parent') !== NULL); } + /** * {@inheritdoc} */ - public function getParent() - { + public function getParent() { return $this->get('fedora_has_parent')->getEntity(); } + /** * {@inheritdoc} */ - public function getParentId() - { + public function getParentId() { return $this->get('fedora_has_parent')->getEntity()->id(); } + /** * {@inheritdoc} */ - public function setParent(EntityTypeInterface $entity) - { + public function setParent(EntityTypeInterface $entity) { $this->set('fedora_has_parent', $entity); return $this; } @@ -247,11 +257,10 @@ class FedoraResource extends ContentEntityBase implements FedoraResourceInterfac * An array of default values. */ public static function getFedoraRoot() { - // Just stub code, we need to figure out what "root is" in this context + // Just stub code, we need to figure out what "root is" in this context. return array('root'); } - /** * {@inheritdoc} */ @@ -301,56 +310,56 @@ class FedoraResource extends ContentEntityBase implements FedoraResourceInterfac ->setDisplayConfigurable('form', TRUE) ->setDisplayConfigurable('view', TRUE); - $fields['fedora_has_parent'] = BaseFieldDefinition::create('entity_reference') - ->setLabel(t('Fedora has Parent')) - ->setDescription(t('Parent Fedora Resource.')) - ->setRevisionable(TRUE) - ->setSetting('target_type', 'fedora_resource') - ->setSetting('handler', 'default') - ->setDefaultValueCallback('Drupal\islandora\Entity\FedoraResource::getFedoraRoot') - ->setTranslatable(TRUE) - ->setDisplayOptions('view', array( - 'label' => 'hidden', - 'type' => 'author', - 'weight' => 0, - )) - ->setDisplayOptions('form', array( - 'type' => 'entity_reference_autocomplete', - 'weight' => 5, - 'settings' => array( - 'match_operator' => 'CONTAINS', - 'size' => '60', - 'autocomplete_type' => 'tags', - 'placeholder' => '', - ), - )) - ->setDisplayConfigurable('form', TRUE) - ->setDisplayConfigurable('view', TRUE); - - $fields['ldp_contains'] = BaseFieldDefinition::create('entity_reference') - ->setLabel(t('LDP Contains')) - ->setDescription(t('Contains Fedora Resource.')) - ->setRevisionable(TRUE) - ->setSetting('target_type', 'fedora_resource_type') - ->setSetting('handler', 'default') - ->setTranslatable(TRUE) - ->setDisplayOptions('view', array( - 'label' => 'hidden', - 'type' => 'author', - 'weight' => 0, - )) - ->setDisplayOptions('form', array( - 'type' => 'entity_reference_autocomplete', - 'weight' => 5, - 'settings' => array( - 'match_operator' => 'CONTAINS', - 'size' => '60', - 'autocomplete_type' => 'tags', - 'placeholder' => '', - ), - )) - ->setDisplayConfigurable('form', TRUE) - ->setDisplayConfigurable('view', TRUE); + $fields['fedora_has_parent'] = BaseFieldDefinition::create('entity_reference') + ->setLabel(t('Fedora has Parent')) + ->setDescription(t('Parent Fedora Resource.')) + ->setRevisionable(TRUE) + ->setSetting('target_type', 'fedora_resource') + ->setSetting('handler', 'default') + ->setDefaultValueCallback('Drupal\islandora\Entity\FedoraResource::getFedoraRoot') + ->setTranslatable(TRUE) + ->setDisplayOptions('view', array( + 'label' => 'hidden', + 'type' => 'author', + 'weight' => 0, + )) + ->setDisplayOptions('form', array( + 'type' => 'entity_reference_autocomplete', + 'weight' => 5, + 'settings' => array( + 'match_operator' => 'CONTAINS', + 'size' => '60', + 'autocomplete_type' => 'tags', + 'placeholder' => '', + ), + )) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE); + + $fields['ldp_contains'] = BaseFieldDefinition::create('entity_reference') + ->setLabel(t('LDP Contains')) + ->setDescription(t('Contains Fedora Resource.')) + ->setRevisionable(TRUE) + ->setSetting('target_type', 'fedora_resource_type') + ->setSetting('handler', 'default') + ->setTranslatable(TRUE) + ->setDisplayOptions('view', array( + 'label' => 'hidden', + 'type' => 'author', + 'weight' => 0, + )) + ->setDisplayOptions('form', array( + 'type' => 'entity_reference_autocomplete', + 'weight' => 5, + 'settings' => array( + 'match_operator' => 'CONTAINS', + 'size' => '60', + 'autocomplete_type' => 'tags', + 'placeholder' => '', + ), + )) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE); $fields['name'] = BaseFieldDefinition::create('string') ->setLabel(t('Name')) diff --git a/src/FedoraResourceHtmlRouteProvider.php b/src/FedoraResourceHtmlRouteProvider.php index 7700bffe..30e689f1 100644 --- a/src/FedoraResourceHtmlRouteProvider.php +++ b/src/FedoraResourceHtmlRouteProvider.php @@ -44,11 +44,11 @@ class FedoraResourceHtmlRouteProvider extends AdminHtmlRouteProvider implements $collection->add("entity.{$entity_type_id}.uuid", $uuid_route); } - return $collection; } - /** Gets the UUID route. + /** + * Gets the UUID route. * * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type * The entity type. diff --git a/src/FedoraResourceInterface.php b/src/FedoraResourceInterface.php index 0270d825..baefb5a8 100644 --- a/src/FedoraResourceInterface.php +++ b/src/FedoraResourceInterface.php @@ -14,8 +14,6 @@ use Drupal\user\EntityOwnerInterface; */ interface FedoraResourceInterface extends ContentEntityInterface, EntityChangedInterface, EntityOwnerInterface { - // Add get/set methods for your configuration properties here. - /** * Gets the Fedora resource type. * @@ -76,7 +74,8 @@ interface FedoraResourceInterface extends ContentEntityInterface, EntityChangedI * Sets the published status of a Fedora resource. * * @param bool $published - * TRUE to set this Fedora resource to published, FALSE to set it to unpublished. + * TRUE to set this Fedora resource to published, FALSE to set it to + * unpublished. * * @return \Drupal\islandora\FedoraResourceInterface * The called Fedora resource entity. @@ -110,11 +109,12 @@ interface FedoraResourceInterface extends ContentEntityInterface, EntityChangedI /** * Get the parent entity. * - * @param \Drupal\islandora\FedoraResourceInterface $parent - * The parent entity + * @param \Drupal\Core\Entity\EntityTypeInterface $entity + * The parent entity. * * @return \Drupal\islandora\FedoraResourceInterface * The called Fedora resource entity. */ public function setParent(EntityTypeInterface $entity); + } diff --git a/src/FedoraResourceViewBuilder.php b/src/FedoraResourceViewBuilder.php index 99c50a50..fd540bdd 100644 --- a/src/FedoraResourceViewBuilder.php +++ b/src/FedoraResourceViewBuilder.php @@ -1,19 +1,11 @@ validateFormValues($entity, $entity_form, $form_state); $entity->setValidationRequired(FALSE); - foreach($form_state->getErrors() as $name => $message) { + foreach ($form_state->getErrors() as $name => $message) { // $name may be unknown in $form_state and - // $form_state->setErrorByName($name, $message) may suppress the error message. + // $form_state->setErrorByName($name, $message) + // may suppress the error message. $form_state->setError($triggering_element, $message); } } @@ -221,7 +222,12 @@ class FedoraResourceEntityInlineForm extends EntityInlineForm implements InlineF // Invoke all specified builders for copying form values to entity fields. if (isset($entity_form['#entity_builders'])) { foreach ($entity_form['#entity_builders'] as $function) { - call_user_func_array($function, [$entity->getEntityTypeId(), $entity, &$entity_form, &$form_state]); + call_user_func_array($function, [ + $entity->getEntityTypeId(), + $entity, + &$entity_form, + &$form_state, + ]); } } } @@ -232,11 +238,12 @@ class FedoraResourceEntityInlineForm extends EntityInlineForm implements InlineF * After field_attach_submit() has run and the form has been closed, the form * state still contains field data in $form_state->get('field'). Unless that * data is removed, the next form with the same #parents (reopened add form, - * for example) will contain data (i.e. uploaded files) from the previous form. + * for example) will contain data (i.e. uploaded files) from the previous + * form. * - * @param $entity_form + * @param array $entity_form * The entity form. - * @param $form_state + * @param \Drupal\Core\Form\FormStateInterface $form_state * The form state of the parent form. */ public static function submitCleanFormState(&$entity_form, FormStateInterface $form_state) { diff --git a/src/Form/IslandoraSettingsForm.php b/src/Form/IslandoraSettingsForm.php index 2c254eff..c01850d8 100644 --- a/src/Form/IslandoraSettingsForm.php +++ b/src/Form/IslandoraSettingsForm.php @@ -1,9 +1,5 @@ https://github.com/diegopino - */ namespace Drupal\islandora\ParamConverter; - use Drupal\Core\ParamConverter\EntityConverter; -use Drupal\Core\ParamConverter\ParamConverterInterface; -use Drupal\Component\Uuid\Uuid; -use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\Routing\Route; /** @@ -30,18 +13,17 @@ use Symfony\Component\Routing\Route; class UuidEntityConverter extends EntityConverter { /** - * @inheritDoc + * {@inheritdoc} */ public function convert($value, $definition, $name, array $defaults) { return $this->entityManager->loadEntityByUuid($name, $value); } /** - * @inheritDoc + * {@inheritdoc} */ public function applies($definition, $name, Route $route) { return (!empty($definition['type']) && $definition['type'] == 'uuid'); } - } diff --git a/src/Plugin/Search/FedoraEntitySearch.php b/src/Plugin/Search/FedoraEntitySearch.php index 42084256..4fd13e50 100644 --- a/src/Plugin/Search/FedoraEntitySearch.php +++ b/src/Plugin/Search/FedoraEntitySearch.php @@ -1,8 +1,4 @@ -getValue('or') != '') { if (preg_match_all('/ ("[^"]+"|[^" ]+)/i', ' ' . $form_state->getValue('or'), $matches)) { @@ -839,4 +834,4 @@ class FedoraResourceSearch extends ConfigurableSearchPluginBase implements Acces } } -} \ No newline at end of file +} diff --git a/tests/scripts/line_endings.sh b/tests/scripts/line_endings.sh new file mode 100755 index 00000000..d16bf328 --- /dev/null +++ b/tests/scripts/line_endings.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +RETURN=0 +FILES=`find -L $1 -name "*.info" -o -name "*.txt" -o -name "*.md"` +echo "Testing for files with DOS line endings..." +for FILE in $FILES +do + file $FILE | grep CRLF + if [ $? == 0 ] + then + RETURN=1 + fi +done +exit $RETURN \ No newline at end of file diff --git a/tests/scripts/travis_setup.sh b/tests/scripts/travis_setup.sh new file mode 100755 index 00000000..3123d11f --- /dev/null +++ b/tests/scripts/travis_setup.sh @@ -0,0 +1,81 @@ +#!/bin/bash +mysql -u root -e 'create database drupal;' +mysql -u root -e "GRANT ALL PRIVILEGES ON drupal.* To 'drupal'@'localhost' IDENTIFIED BY 'drupal';" + +# Java (Oracle) +sudo apt-get install -y software-properties-common +sudo apt-get install -y python-software-properties +sudo add-apt-repository -y ppa:webupd8team/java +sudo apt-get update +echo debconf shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections +echo debconf shared/accepted-oracle-license-v1-1 seen true | sudo debconf-set-selections +sudo apt-get install -y oracle-java8-installer +sudo update-java-alternatives -s java-8-oracle +sudo apt-get install -y oracle-java8-set-default +export JAVA_HOME=/usr/lib/jvm/java-8-oracle + +# phpcpd +#sudo apt-get install -y phpcpd + +cd $HOME +pear channel-discover pear.drush.org +pear upgrade --force Console_GetoptPlus +pear upgrade --force pear +pear channel-discover pear.drush.org + +# Drush +cd /tmp +php -r "readfile('https://s3.amazonaws.com/files.drush.org/drush.phar');" > drush +php drush core-status +chmod +x drush +sudo mv drush /opt +sudo ln -s /opt/drush /usr/bin/drush + +phpenv rehash + +cd $HOME +drush dl drupal-8.2.2 --drupal-project-rename=drupal +cd $HOME/drupal +drush si minimal --db-url=mysql://drupal:drupal@localhost/drupal --yes +drush runserver --php-cgi=$HOME/.phpenv/shims/php-cgi localhost:8081 &>/tmp/drush_webserver.log & + +ln -s $ISLANDORA_DIR modules/islandora +drush en -y rdf +drush en -y responsive_image +drush en -y syslog +drush en -y serialization +drush en -y basic_auth +drush en -y rest + +drush dl rdfui --dev +drush en -y rdfui +drush en -y rdf_builder + +drush dl restui +drush en -y restui + +drush dl inline_entity_form +drush en -y inline_entity_form + +drush dl media_entity +drush en -y media_entity + +drush dl media_entity_image +drush en -y media_entity_image + +drush dl search_api +drush -y pm-uninstall search +drush en -y search_api + +cd $HOME/drupal/modules +git clone https://github.com/DiegoPino/claw-jsonld.git +drush en -y jsonld + +drush -y dl bootstrap +drush -y en bootstrap +drush -y config-set system.theme default bootstrap + +drush cr +# The shebang in this file is a bogeyman that is haunting the web test cases. +rm /home/travis/.phpenv/rbenv.d/exec/hhvm-switcher.bash +sleep 20