function EntityLegacyTest::testEntityLoadMultipleByProperties

@expectedDeprecation entity_load_multiple_by_properties() is deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use the entity type storage's loadByProperties() method. See https://www.drupal.org/node/3050910

File

core/tests/Drupal/KernelTests/Core/Entity/EntityLegacyTest.php, line 112

Class

EntityLegacyTest
Tests legacy entity functions.

Namespace

Drupal\KernelTests\Core\Entity

Code

public function testEntityLoadMultipleByProperties() {
    $this->assertCount(0, entity_load_multiple_by_properties('entity_test', [
        'name' => 'published entity',
    ]));
    EntityTest::create([
        'name' => 'published entity',
    ])->save();
    $this->assertCount(1, entity_load_multiple_by_properties('entity_test', [
        'name' => 'published entity',
    ]));
    $this->assertCount(0, entity_load_multiple_by_properties('entity_test_mul', [
        'name' => 'published entity',
    ]));
    EntityTest::create([
        'name' => 'published entity',
    ])->save();
    EntityTestMul::create([
        'name' => 'published entity',
    ])->save();
    $this->assertCount(2, entity_load_multiple_by_properties('entity_test', [
        'name' => 'published entity',
    ]));
    $this->assertCount(1, entity_load_multiple_by_properties('entity_test_mul', [
        'name' => 'published entity',
    ]));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.