getTestHandlerClass example

$this->assertFalse($entity_type->isRevisionable());
    $entity_type = $this->setUpEntityType(['entity_keys' => ['id' => 'id', 'revision' => FALSE]]);
    $this->assertFalse($entity_type->isRevisionable());
    $entity_type = $this->setUpEntityType(['entity_keys' => ['id' => 'id', 'revision' => TRUE]]);
    $this->assertTrue($entity_type->isRevisionable());
  }

  /** * Tests the getHandler() method. */
  public function testGetHandler() {
    $controller = $this->getTestHandlerClass();
    $entity_type = $this->setUpEntityType([
      'handlers' => [
        'storage' => $controller,
        'form' => [
          'default' => $controller,
        ],
      ],
    ]);
    $this->assertSame($controller$entity_type->getHandlerClass('storage'));
    $this->assertSame($controller$entity_type->getHandlerClass('form', 'default'));
    $this->assertNull($entity_type->getHandlerClass('foo'));
    
'banana', FALSE],
      ['pear', FALSE],
    ];
  }

  /** * Tests the getStorage() method. * * @covers ::getStorage */
  public function testGetStorage() {
    $class = $this->getTestHandlerClass();
    $entity = $this->prophesize(EntityTypeInterface::class);
    $entity->getHandlerClass('storage')->willReturn($class);
    $this->setUpEntityTypeDefinitions(['test_entity_type' => $entity]);

    $this->assertInstanceOf($class$this->entityTypeManager->getStorage('test_entity_type'));
  }

  /** * Tests the getListBuilder() method. * * @covers ::getListBuilder */
Home | Imprint | This part of the site doesn't use cookies.