/**
  * Tests basic API methods of the plugin.
  */
 protected function testGoogle()
 {
     $plugin = $this->translator->getPlugin();
     $this->assertTrue($plugin instanceof GoogleTranslator, 'Plugin is a GoogleTranslator');
     $job = $this->createJob();
     $job->translator = $this->translator->id();
     $item = $job->addItem('test_source', 'test', '1');
     $item->data = array('wrapper' => array('#text' => 'Hello world'));
     $item->save();
     $this->assertFalse($job->isTranslatable(), 'Check if the translator is not available at this point because we did not define the API parameters.');
     // Save a wrong api key.
     $this->translator->setSetting('api_key', 'wrong key');
     $this->translator->save();
     $languages = $this->translator->getSupportedTargetLanguages('en');
     $this->assertTrue(empty($languages), t('We can not get the languages using wrong api parameters.'));
     // Save a correct api key.
     $this->translator->setSetting('api_key', 'correct key');
     $this->translator->save();
     // Make sure the translator returns the correct supported target languages.
     $this->translator->clearLanguageCache();
     $languages = $this->translator->getSupportedTargetLanguages('en');
     $this->assertTrue(isset($languages['de']));
     $this->assertTrue(isset($languages['fr']));
     // As we requested source language english it should not be included.
     $this->assertTrue(!isset($languages['en']));
     $this->assertTrue($job->canRequestTranslation()->getSuccess());
     $job->requestTranslation();
     // Now it should be needs review.
     foreach ($job->getItems() as $item) {
         $this->assertTrue($item->isNeedsReview());
     }
     $items = $job->getItems();
     $item = end($items);
     $data = $item->getData();
     $this->assertEqual('Hallo Welt', $data['dummy']['deep_nesting']['#translation']['#text']);
 }