/**
  * Tests the UI of the plugin.
  */
 protected function testMicrosoftUi()
 {
     $this->loginAsAdmin();
     $edit = ['settings[api_key]' => 'wrong key'];
     $this->drupalPostForm('admin/config/regional/tmgmt_translator/manage/' . $this->translator->id(), $edit, t('Save'));
     $this->assertText(t('The "Google API key" is not correct.'));
     $edit = ['settings[api_key]' => 'correct key'];
     $this->drupalPostForm('admin/config/regional/tmgmt_translator/manage/' . $this->translator->id(), $edit, t('Save'));
     $this->assertText(t('@label configuration has been updated.', ['@label' => $this->translator->label()]));
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 function checkAvailable(TranslatorInterface $translator)
 {
     if ($translator->getSetting('action') == 'not_available') {
         return AvailableResult::no(t('@translator is not available. Make sure it is properly <a href=:configured>configured</a>.', ['@translator' => $translator->label(), ':configured' => $translator->url()]));
     }
     return parent::checkAvailable($translator);
 }
 /**
  * {@inheritdoc}
  */
 public function checkAvailable(TranslatorInterface $translator)
 {
     if ($translator->getSetting('client_id') && $translator->getSetting('client_secret')) {
         return AvailableResult::yes();
     }
     return AvailableResult::no(t('@translator is not available. Make sure it is properly <a href=:configured>configured</a>.', ['@translator' => $translator->label(), ':configured' => $translator->url()]));
 }