public function BatchTest::testAddItem in Akamai 7.3
Tests that items are added to a batch correctly.
@covers Drupal\akamai\Batch::addItem
File
- tests/
BatchTest.php, line 19 - Unit tests for the Drupal\akamai\Batch class.
Class
Namespace
Drupal\akamai\TestsCode
public function testAddItem() {
$hostname = 'www.example.com';
$num_items = 3;
$items = [];
$batch = new Batch();
for ($i = 1; $i <= $num_items; $i++) {
$item = (object) [
'item_id' => $i,
'data' => [
'hostname' => $hostname,
'paths' => [
'node/' . $i,
],
],
];
$items[] = $item;
$batch
->addItem($item);
}
$this
->assertSame($batch
->getHostname(), $hostname, 'Hostname of batch did not match.');
$this
->assertSame($batch
->getItems(), $items, 'Batch items did not match.');
}