Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update .travis.yml #48

Merged
merged 2 commits into from
Nov 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ branches:
- /main/

before_install:
- export SCRIPT_DIR=$HOME/islandora/.scripts
- export SCRIPT_DIR=$HOME/islandora_ci
- export DRUPAL_DIR=/opt/drupal
- export COMPOSER_PATH="/home/travis/.phpenv/versions/$TRAVIS_PHP_VERSION/bin/composer"

install:
- git clone https://github.com/Islandora/documentation.git $HOME/islandora
- git clone https://github.com/Islandora/islandora_ci.git $HOME/islandora_ci

before_script:
- $SCRIPT_DIR/travis_setup_drupal.sh
Expand Down
18 changes: 18 additions & 0 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/ContextGenerator/JsonldContextGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public function getContext($ids) {
* {@inheritdoc}
*/
public function generateContext(RdfMappingInterface $rdfMapping) {
// TODO: we will need to use \Drupal\Core\Field\FieldDefinitionInterface
// @todo we will need to use \Drupal\Core\Field\FieldDefinitionInterface
// a lot to be able to create/frame/discern drupal bundles based on JSON-LD
// So keep an eye on that definition.
$allRdfNameSpaces = rdf_get_namespaces();
Expand Down Expand Up @@ -308,7 +308,7 @@ protected function parseCompactedIri($iri) {
/**
* Naive approach on Drupal field to JSON-LD type mapping.
*
* TODO: Would be fine to have this definitions in an
* @todo Would be fine to have this definitions in an
* configEntity way in the future.
*
* @param string $field_type
Expand Down
4 changes: 2 additions & 2 deletions src/Controller/JsonldContextController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use Drupal\Core\Cache\CacheableMetadata;

/**
* Class JsonldContextController.
* Controller for retrieving jsonld contexts.
*
* @package Drupal\jsonld\Controller
*/
Expand Down Expand Up @@ -64,7 +64,7 @@ public static function create(ContainerInterface $container) {
*/
public function content($entity_type, $bundle, Request $request) {

// TODO: expose cached/not cached through
// @todo expose cached/not cached through
// more varied HTTP response codes.
try {
$context = $this->jsonldContextGenerator->getContext("$entity_type.$bundle");
Expand Down
2 changes: 1 addition & 1 deletion src/Form/JsonLdSettingsForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Drupal\Core\Form\FormStateInterface;

/**
* Class JsonLdSettingsForm.
* Config form for the module.
*
* @package Drupal\jsonld\Form
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Normalizer/ContentEntityNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public function __construct(LinkManagerInterface $link_manager,
public function normalize($entity, $format = NULL, array $context = []) {

// We need to make sure that this only runs for JSON-LD.
// @TODO check $format before going RDF crazy
// @todo check $format before going RDF crazy
$normalized = [];

if (isset($context['depth'])) {
Expand Down Expand Up @@ -148,7 +148,7 @@ public function normalize($entity, $format = NULL, array $context = []) {
}

// Create the array of normalized fields, starting with the URI.
/* @var $entity \Drupal\Core\Entity\ContentEntityInterface */
/** @var \Drupal\Core\Entity\ContentEntityInterface $entity */
$normalized = $normalized + [
'@graph' => [
$this->getEntityUri($entity) => [
Expand Down
2 changes: 1 addition & 1 deletion src/Normalizer/EntityReferenceItemNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function __construct(LinkManagerInterface $link_manager,
*/
public function normalize($field_item, $format = NULL, array $context = []) {

/* @var $field_item \Drupal\Core\Field\FieldItemInterface */
/** @var \Drupal\Core\Field\FieldItemInterface $field_item */
$target_entity = $field_item->get('entity')->getValue();
$normalized_prop = [];
// If this is not a content entity, let the parent implementation handle it,
Expand Down
2 changes: 1 addition & 1 deletion src/Normalizer/FieldItemNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function __construct(JsonldContextGeneratorInterface $jsonld_context) {
*/
public function normalize($field_item, $format = NULL, array $context = []) {

// @TODO Understand Drupal complex fields to RDF mapping
// @todo Understand Drupal complex fields to RDF mapping
// Fields can be complex, with multiple subfields
// but i'm not sure if rdf module
// is able to assign that, so investigate:
Expand Down
15 changes: 12 additions & 3 deletions tests/src/Functional/JsonldContextGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ public function setUp() {
* Tests that the Context Response Page can be reached.
*/
public function testJsonldcontextPageExists() {
$url = Url::fromRoute('jsonld.context', ['entity_type' => 'node', 'bundle' => 'test_type']);
$url = Url::fromRoute(
'jsonld.context',
['entity_type' => 'node', 'bundle' => 'test_type']
);
$this->drupalGet($url);
$this->assertSession()->statusCodeEquals(200);
}
Expand All @@ -84,7 +87,10 @@ public function testJsonldcontextPageExists() {
* Tests that the response is in fact application/ld+json.
*/
public function testJsonldcontextContentypeheaderResponseIsValid() {
$url = Url::fromRoute('jsonld.context', ['entity_type' => 'node', 'bundle' => 'test_type']);
$url = Url::fromRoute(
'jsonld.context',
['entity_type' => 'node', 'bundle' => 'test_type']
);
$this->drupalGet($url);
$this->assertSession()->statusCodeEquals(200);
$this->assertEquals($this->drupalGetHeader('Content-Type'), 'application/ld+json', 'Correct JSON-LD mime type was returned');
Expand All @@ -107,7 +113,10 @@ public function testJsonldcontextResponseIsValid() {
],
];

$url = Url::fromRoute('jsonld.context', ['entity_type' => 'node', 'bundle' => 'test_type']);
$url = Url::fromRoute(
'jsonld.context',
['entity_type' => 'node', 'bundle' => 'test_type']
);
$this->drupalGet($url);
$this->assertSession()->statusCodeEquals(200);
$jsonldarray = json_decode($this->getSession()->getPage()->getContent(), TRUE);
Expand Down
2 changes: 1 addition & 1 deletion tests/src/Kernel/JsonldHookTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Drupal\Tests\jsonld\Kernel;

/**
* Class JsonldHookTest.
* Tests the module hooks.
*
* @package Drupal\Tests\jsonld\Kernel
* @group jsonld
Expand Down
4 changes: 3 additions & 1 deletion tests/src/Kernel/JsonldKernelTestBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,9 @@ protected function setUp() {
$entity_manager = \Drupal::service('entity_type.manager');
$link_manager = \Drupal::service('hal.link_manager');
$uuid_resolver = \Drupal::service('serializer.entity_resolver.uuid');
$chain_resolver = new ChainEntityResolver([$uuid_resolver, new TargetIdResolver()]);
$chain_resolver = new ChainEntityResolver(
[$uuid_resolver, new TargetIdResolver()]
);

$jsonld_context_generator = $this->container->get('jsonld.contextgenerator');

Expand Down