Skip to content
Snippets Groups Projects
Commit 780c844c authored by Joseph Olstad's avatar Joseph Olstad
Browse files

Issue #3455186 by joseph.olstad - Refactor of 88f1e040 for tests for D11...

Issue #3455186 by joseph.olstad - Refactor of 88f1e040 for tests for D11 phpunit 10+ compatibility refactoring test.
parent 390f6c20
No related branches found
No related tags found
No related merge requests found
Pipeline #333479 failed
......@@ -311,11 +311,13 @@ use Drupal\Core\Link;
use IteratorAggregate;
use Traversable;
use ArrayIterator;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Entity\EntityChangedInterface;
/**
* Mock implementation of TermInterface for unit tests.
*/
class MockTerm implements TermInterface, IteratorAggregate {
class MockTerm implements TermInterface, IteratorAggregate, EntityChangedInterface {
public $parent;
private $id;
private $label;
......@@ -364,6 +366,8 @@ class MockTerm implements TermInterface, IteratorAggregate {
return 'default';
}
public function setVocabularyId($vid) {}
public function getWeight() {
return 0;
}
......@@ -378,7 +382,9 @@ class MockTerm implements TermInterface, IteratorAggregate {
return false;
}
public function get($field_name) {}
public function get($field_name) {
return NULL;
}
public function set($field_name, $value, $notify = true) {}
......@@ -398,27 +404,64 @@ class MockTerm implements TermInterface, IteratorAggregate {
return true;
}
public function getIterator(): Traversable {
return new ArrayIterator([]);
public function getDescription() {
return '';
}
public function bundle() {
return 'taxonomy_term';
public function setDescription($description) {}
public function getFormat() {
return 'plain_text';
}
public function setFormat($format) {}
public function getTranslatableFields() {
return [];
}
public function baseFieldDefinitions($entity_type) {
return [];
}
public function bundleFieldDefinitions($entity_type, $bundle) {
return [];
}
public function getFieldDefinitions() {
return [];
}
public function getEntityTypeId() {
return 'taxonomy_term';
}
public function bundle() {
return 'taxonomy_term';
}
public function uuid() {
return 'mock-uuid';
}
public function save() {}
public function delete() {}
public function isNew() {
return false;
}
public function enforceIsNew($value = true) {}
public function getChangedTime() {
return time();
}
public function setChangedTime($timestamp) {}
public function getIterator(): Traversable {
return new ArrayIterator([]);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment