Unverified Commit 5a389ac8 authored by Mateu Aguiló Bosch's avatar Mateu Aguiló Bosch
Browse files

test(Misc): Add test coverage to the SubrequestsTree

parent b9c94653
<?php
namespace Drupal\Tests\subrequests\Unit;
use Drupal\subrequests\Subrequest;
use Drupal\subrequests\SubrequestsTree;
use Drupal\Tests\UnitTestCase;
/**
* @coversDefaultClass \Drupal\subrequests\SubrequestsTree
* @group subrequests
*/
class SubrequestsTreeTest extends UnitTestCase {
/**
* @dataProvider dataProviderStack
* @covers ::stack
* @covers ::getLowestLevel
* @covers ::getNumLevels
*/
public function testStack($input, $expected_count) {
$sut = new SubrequestsTree();
$sut->stack($input);
$this->assertSame(1, $sut->getNumLevels());
$this->assertSame($expected_count, count($sut->getLowestLevel()));
}
public function dataProviderStack() {
$defaults = [
'requestId' => 1,
'body' => '',
'headers' => [],
'waitFor' => 1,
'_resolved' => FALSE,
'uri' => '',
'action' => '',
];
return [
[[new Subrequest($defaults), 12, new Subrequest($defaults)], 2],
[[12], 0],
];
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment