/** * Tests the setIfOwner() method with matching and non matching owners. * * @covers ::setIfOwner */ public function testSetIfOwner() { $this->lock->expects($this->once())->method('acquire')->with('test')->will($this->returnValue(TRUE)); $this->keyValue->expects($this->exactly(2))->method('setWithExpireIfNotExists')->will($this->returnValue(FALSE)); $this->keyValue->expects($this->exactly(2))->method('get')->with('test')->will($this->onConsecutiveCalls($this->ownObject, $this->otherObject)); $this->assertTrue($this->tempStore->setIfOwner('test', 'test_data')); $this->assertFalse($this->tempStore->setIfOwner('test', 'test_data')); }
/** * {@inheritdoc} */ public function save() { return $this->tempStore->setIfOwner($this->entity->id(), $this->entity); }