Skip to content

Commit

Permalink
DDST-454: Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
bibliophileaxe committed Aug 15, 2024
1 parent d7d92a5 commit 7a745f0
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions tests/src/Traits/IslandoraContentTypeTestTraits.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
use Drupal\Tests\user\Traits\UserCreationTrait;

/**
* Useful test traits for Islandora. Creates Islanodra node, media and files.
* Useful test traits for Islandora. Creates Islandora node, media and files.
*/
trait IslandoraContentTypeTestTraits {
use EntityReferenceFieldCreationTrait;
Expand Down Expand Up @@ -55,7 +55,7 @@ trait IslandoraContentTypeTestTraits {
protected VocabularyInterface $modelsVocabulary;

/**
* {@inheritDoc}
* Creates a node type, media type, and vocabulary for Islandora.
*/
protected function prepareIslandoraContentType() : void {
// Create content required for creating islandora-esque data.
Expand Down Expand Up @@ -84,8 +84,6 @@ protected function prepareIslandoraContentType() : void {
*
* @return \Drupal\node\NodeInterface
* A created (and saved) node entity.
*
* @throws \Drupal\Core\Entity\EntityStorageException
*/
protected function createNode() : NodeInterface {
if (empty($this->contentType)) {
Expand All @@ -104,8 +102,6 @@ protected function createNode() : NodeInterface {
*
* @return \Drupal\file\FileInterface
* A created (and saved) file entity.
*
* @throws \Drupal\Core\Entity\EntityStorageException
*/
protected function createFile() : FileInterface {
/** @var \Drupal\file\FileInterface $entity */
Expand All @@ -121,7 +117,7 @@ protected function createFile() : FileInterface {
* @return string
* File URI.
*/
protected function createUri() {
protected function createUri(): string {
$filepath = 'test file ' . $this->randomMachineName();
$scheme = 'public';
$filepath = $scheme . '://' . $filepath;
Expand Down Expand Up @@ -175,12 +171,17 @@ protected function getMediaFieldName() : string {

/**
* Helper; Creates the islandora models vocabulary.
*
* @return \Drupal\taxonomy\VocabularyInterface
* The created vocabulary.
*
* @throws \Drupal\Core\Entity\EntityStorageException
*/
protected function createModelsVocabulary() : Vocabulary {
$vocabulary = $this->createVocabulary(['vid' => 'islandora_models']);

// Create link type field on vocabulary for external uri.
$field_name = 'field_external_uri';
$field_name = IslandoraUtils::EXTERNAL_URI_FIELD;

// Create a field with settings to validate.
$storage_definition = [
Expand All @@ -206,6 +207,9 @@ protected function createModelsVocabulary() : Vocabulary {

/**
* Creates a non-islandora node.
*
* @return \Drupal\node\NodeInterface
* A created (and saved) node entity.
*/
public function createNonIslandoraNode(): NodeInterface {
/** @var \Drupal\node\NodeInterface $entity */
Expand Down

0 comments on commit 7a745f0

Please sign in to comment.