EntityConditionGroupTest.php in Drupal 10
File
core/modules/jsonapi/tests/src/Unit/Query/EntityConditionGroupTest.php
View source
<?php
namespace Drupal\Tests\jsonapi\Unit\Query;
use Drupal\jsonapi\Query\EntityConditionGroup;
use Drupal\Tests\UnitTestCase;
class EntityConditionGroupTest extends UnitTestCase {
public function testConstruct($case) {
$group = new EntityConditionGroup($case['conjunction'], $case['members']);
$this
->assertEquals($case['conjunction'], $group
->conjunction());
foreach ($group
->members() as $key => $condition) {
$this
->assertEquals($case['members'][$key]['path'], $condition
->field());
$this
->assertEquals($case['members'][$key]['value'], $condition
->value());
}
}
public function testConstructException() {
$this
->expectException(\InvalidArgumentException::class);
new EntityConditionGroup('NOT_ALLOWED', []);
}
public function constructProvider() {
return [
[
[
'conjunction' => 'AND',
'members' => [],
],
],
[
[
'conjunction' => 'OR',
'members' => [],
],
],
];
}
}