function ConfigEntityBaseUnitTest::testToArray

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityBaseUnitTest::testToArray()
  2. 10 core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityBaseUnitTest::testToArray()
  3. 11.x core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityBaseUnitTest::testToArray()

@covers ::toArray

File

core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php, line 560

Class

ConfigEntityBaseUnitTest
@coversDefaultClass \Drupal\Core\Config\Entity\ConfigEntityBase @group Config

Namespace

Drupal\Tests\Core\Config\Entity

Code

public function testToArray() {
    $this->typedConfigManager
        ->expects($this->never())
        ->method('getDefinition');
    $this->entityType
        ->expects($this->any())
        ->method('getPropertiesToExport')
        ->willReturn([
        'id' => 'configId',
        'dependencies' => 'dependencies',
    ]);
    $properties = $this->entity
        ->toArray();
    $this->assertIsArray($properties);
    $this->assertEquals([
        'configId' => $this->entity
            ->id(),
        'dependencies' => [],
    ], $properties);
}

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