/** * {@inheritdoc} */ public function buildForm(array $form, FormStateInterface $form_state) { if (!$this->tempStore->getMetadata($this->entity->id())) { $form['message']['#markup'] = $this->t('There is no lock on view %name to break.', array('%name' => $this->entity->id())); return $form; } return parent::buildForm($form, $form_state); }
/** * Tests the getMetadata() method. * * @covers ::getMetadata() */ public function testGetMetadata() { $this->keyValue->expects($this->at(0))->method('get')->with('test')->will($this->returnValue($this->ownObject)); $this->keyValue->expects($this->at(1))->method('get')->with('test')->will($this->returnValue(FALSE)); $metadata = $this->tempStore->getMetadata('test'); $this->assertObjectHasAttribute('owner', $metadata); // Data should get removed. $this->assertObjectNotHasAttribute('data', $metadata); $this->assertNull($this->tempStore->getMetadata('test')); }