You are here

public function PaymentStatusManagerTest::testHasAncestor in Payment 8.2

@covers ::hasAncestor @depends testGetDefinitions

File

tests/src/Unit/Plugin/Payment/Status/PaymentStatusManagerTest.php, line 206

Class

PaymentStatusManagerTest
@coversDefaultClass \Drupal\payment\Plugin\Payment\Status\PaymentStatusManager

Namespace

Drupal\Tests\payment\Unit\Plugin\Payment\Status

Code

public function testHasAncestor() {
  $definitions = array(
    'foo' => array(
      'id' => 'foo',
    ),
    'bar' => array(
      'id' => 'bar',
      'parent_id' => 'foo',
    ),
    'baz' => array(
      'id' => 'baz',
      'parent_id' => 'bar',
    ),
  );
  $this->discovery
    ->expects($this
    ->once())
    ->method('getDefinitions')
    ->willReturn($definitions);
  $this
    ->assertTrue($this->sut
    ->hasAncestor('baz', 'foo'));
  $this
    ->assertFalse($this->sut
    ->hasAncestor('baz', 'baz'));
}