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

Issue #3455186 by cmlara, joseph.olstad - Refactor tests for D11 phpunit 10+...

Issue #3455186 by cmlara, joseph.olstad - Refactor tests for D11 phpunit 10+ compatibility refactoring test.
parent 2ad00369
No related branches found
No related tags found
No related merge requests found
Pipeline #333198 failed
......@@ -9,6 +9,7 @@ use Drupal\Core\Field\EntityReferenceFieldItemListInterface;
use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\Link;
use Drupal\cshs\Plugin\Field\FieldFormatter\CshsGroupByRootFormatter;
use Drupal\taxonomy\Entity\Term;
use Drupal\taxonomy\TermInterface;
use Drupal\taxonomy\TermStorageInterface;
use Drupal\Tests\UnitTestCase;
......@@ -107,40 +108,40 @@ class CshsGroupByRootFormatterUnitTest extends UnitTestCase {
* @param string|null $parent
* The parent term ID (if any).
*
* @return Drupal\Core\Entity\ContentEntityInterface
* @return object
* The stubbed term object.
*/
protected function createMockTerm(int $id, string $label, Link $link, $parent = NULL): ContentEntityInterface {
$term_mock = $this->getMockBuilder(Term::class)
->disableOriginalConstructor()
->onlyMethods([
'id',
'label',
'toLink',
'getFields',
'getFieldDefinition',
'getTranslatableFields',
'toArray',
'set',
'get',
'hasField',
'loadAllParents',
])
->getMock();
$term_mock->method('id')->willReturn($id);
$term_mock->method('label')->willReturn($label);
$term_mock->method('toLink')->willReturn($link);
$term_mock->method('getFields')->willReturn([]);
$term_mock->method('getFieldDefinition')->willReturn(NULL);
$term_mock->method('getTranslatableFields')->willReturn([]);
$term_mock->method('toArray')->willReturn([]);
$term_mock->method('set')->willReturnSelf();
$term_mock->method('get')->willReturn(NULL);
$term_mock->method('hasField')->willReturn(FALSE);
$term_mock->method('loadAllParents')->willReturn([]);
return $term_mock;
$term_mock = $this->getMockBuilder(\Drupal\taxonomy\Entity\Term::class)
->disableOriginalConstructor()
->onlyMethods([
'id',
'label',
'toLink',
'getFields',
'getFieldDefinition',
'getTranslatableFields',
'toArray',
'set',
'get',
'hasField',
'loadAllParents'
])
->getMock();
$term_mock->method('id')->willReturn($id);
$term_mock->method('label')->willReturn($label);
$term_mock->method('toLink')->willReturn($link);
$term_mock->method('getFields')->willReturn([]);
$term_mock->method('getFieldDefinition')->willReturn(NULL);
$term_mock->method('getTranslatableFields')->willReturn([]);
$term_mock->method('toArray')->willReturn([]);
$term_mock->method('set')->willReturnSelf();
$term_mock->method('get')->willReturn(NULL);
$term_mock->method('hasField')->willReturn(FALSE);
$term_mock->method('loadAllParents')->willReturn([]);
return $term_mock;
}
/**
......
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