tests passing

This commit is contained in:
naomi 2022-05-15 18:52:00 +01:00
parent 107d0d6a8c
commit b000e9414b
2 changed files with 8 additions and 22 deletions

View File

@ -9,14 +9,14 @@ use Drupal\Core\Entity\EntityTypeManagerInterface;
class Utils {
public function __construct(
EntityTypeManager $entityTypeManager = null
) {
if ($entityTypeManager == null) {
$entityTypeManager = Drupal::entityTypeManager();
}
$this->entityTypeManager = $entityTypeManager;
}
// public function __construct(
// EntityTypeManager $entityTypeManager = null
// ) {
// if ($entityTypeManager == null) {
// $entityTypeManager = Drupal::entityTypeManager();
// }
// $this->entityTypeManager = $entityTypeManager;
// }
public function addConditionsToQuery(QueryInterface $query, array $conditions): void {
foreach($conditions as $condition) {

View File

@ -1,14 +0,0 @@
<?php declare(strict_types = 1);
namespace Drupal\Tests\opencase\Unit;
use Drupal\Tests\UnitTestCase;
use Drupal\opencase\Utils;
class UtilsTest extends UnitTestCase{
public function setUp(): void {
/** @var \Drupal\core\Entity\EntityTypeManager&\PHPUnit\Framework\MockObject\MockObject $entityTypeManager */
$this->entityTypeManager = $this->getMockBuilder('\\Drupal\\Core\\Entity\\EntityTypeManager')->disableOriginalConstructor()->getMock();
$this->utils = new Utils($this->entityTypeManager);
}
}