removed unused code

This commit is contained in:
naomi 2022-05-27 09:49:23 +01:00
parent 9862e65ea9
commit a228ea5554
2 changed files with 1 additions and 4 deletions

View File

@ -3,10 +3,8 @@
namespace Drupal\opencase; namespace Drupal\opencase;
use \Drupal; use \Drupal;
use Drupal\Core\Entity\EntityTypeManager;
use Drupal\Core\Entity\Query\QueryInterface; use Drupal\Core\Entity\Query\QueryInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Entity\EntityTypeManagerInterface;
use RuntimeException;
class Utils { class Utils {
@ -40,7 +38,7 @@ class Utils {
*/ */
public function getTidByName(string $name, string $vid):int { public function getTidByName(string $name, string $vid):int {
if (empty($name) || empty($vid)) { if (empty($name) || empty($vid)) {
return 0; return 0;
} }
$properties = [ $properties = [
'name' => $name, 'name' => $name,

View File

@ -16,7 +16,6 @@ class UtilsTest extends UnitTestCase{
} }
public function testGetTidByNameGetsTid():void { public function testGetTidByNameGetsTid():void {
$this->entityTypeManager->method('getStorage')->willReturn($this->storage);
$term_entity = $this->getMockBuilder('\\Drupal\\Core\\Entity\\EntityBase')->disableOriginalConstructor()->getMock(); $term_entity = $this->getMockBuilder('\\Drupal\\Core\\Entity\\EntityBase')->disableOriginalConstructor()->getMock();
$term_entity->expects($this->once())->method('id')->willReturn('3'); $term_entity->expects($this->once())->method('id')->willReturn('3');
$this->storage->expects($this->once())->method('loadByProperties')->with(['name' => 'foo', 'vid' => 'bar']) $this->storage->expects($this->once())->method('loadByProperties')->with(['name' => 'foo', 'vid' => 'bar'])