/** * @covers ::getTitle */ public function testGetTitleWithTitleArguments() { $this->pluginDefinition['title'] = new TranslatableMarkup('Example @test', array('@test' => 'value'), [], $this->stringTranslation); $this->stringTranslation->expects($this->once())->method('translateString')->with($this->pluginDefinition['title'])->will($this->returnValue('Example value')); $this->setupLocalTaskDefault(); $this->assertEquals('Example value', $this->localTaskBase->getTitle()); }
/** * @covers ::getTitle */ public function testGetTitleWithTitleArguments() { $this->pluginDefinition['title'] = 'Example @test'; $this->pluginDefinition['title_arguments'] = array('@test' => 'value'); $this->stringTranslation->expects($this->once())->method('translate')->with($this->pluginDefinition['title'], $this->arrayHasKey('@test'), array())->will($this->returnValue('Example value')); $this->setupLocalTaskDefault(); $request = new Request(); $this->assertEquals('Example value', $this->localTaskBase->getTitle($request)); }
/** * {@inheritdoc} */ public function getTitle() { if (!$this->moderationInfo->isModeratableEntity($this->entity)) { // Moderation isn't enabled. return parent::getTitle(); } // @todo write a test for this. return $this->moderationInfo->isLiveRevision($this->entity) ? $this->t('New draft') : $this->t('Edit draft'); }
/** * {@inheritdoc} */ public function getTitle() { if (!$this->moderationInfo->isModeratedEntity($this->entity)) { // Moderation isn't enabled. return parent::getTitle(); } // @todo https://www.drupal.org/node/2779933 write a test for this. return $this->moderationInfo->isLiveRevision($this->entity) ? $this->t('New draft') : $this->t('Edit draft'); }