public function PushQueueTest::testClaimItems in Salesforce Suite 8.4
Same name and namespace in other branches
- 8.3 modules/salesforce_push/tests/src/Unit/PushQueueTest.php \Drupal\Tests\salesforce_push\Unit\PushQueueTest::testClaimItems()
- 5.0.x modules/salesforce_push/tests/src/Unit/PushQueueTest.php \Drupal\Tests\salesforce_push\Unit\PushQueueTest::testClaimItems()
@covers ::claimItems
File
- modules/
salesforce_push/ tests/ src/ Unit/ PushQueueTest.php, line 117
Class
- PushQueueTest
- Test Object instantitation.
Namespace
Drupal\Tests\salesforce_push\UnitCode
public function testClaimItems() {
$this->queue = PushQueue::create(\Drupal::getContainer());
// Test claiming items.
$items = [
1,
2,
3,
];
$this->queryRange = $this
->getMockBuilder(StatementInterface::class)
->getMock();
$this->queryRange
->expects($this
->once())
->method('fetchAllAssoc')
->willReturn($items);
$this->database
->expects($this
->once())
->method('queryRange')
->willReturn($this->queryRange);
$this->updateQuery = $this
->getMockBuilder(Update::class)
->disableOriginalConstructor()
->getMock();
$this->updateQuery
->expects($this
->once())
->method('fields')
->willReturn($this->updateQuery);
$this->updateQuery
->expects($this
->any())
->method('condition')
->willReturn($this->updateQuery);
$this->updateQuery
->expects($this
->once())
->method('execute')
->willReturn(TRUE);
$this->database
->expects($this
->once())
->method('update')
->willReturn($this->updateQuery);
$this
->assertEquals($items, $this->queue
->claimItems(0));
}