Commit d4b7bc78 authored by webchick's avatar webchick

Issue #2341927 by martin107: Language module annotation improvements [ plus minor followup ].

parent 8db6d1f2
......@@ -1269,7 +1269,7 @@ function drupal_installation_attempted() {
* It can be: LanguageInterface::STATE_CONFIGURABLE,
* LanguageInterface::STATE_LOCKED, LanguageInterface::STATE_ALL.
*
* @return array
* @return \Drupal\Core\Language\LanguageInterface[]
* An associative array of languages, keyed by the language code, ordered by
* weight ascending and name ascending.
*
......
......@@ -28,7 +28,7 @@ class LanguageManager implements LanguageManagerInterface {
/**
* An array of all the available languages keyed by language code.
*
* @var array
* @var \Drupal\Core\Language\LanguageInterface[]
*/
protected $languages;
......
......@@ -92,7 +92,7 @@ public function getDefaultLanguage();
* It can be: LanguageInterface::STATE_CONFIGURABLE,
* LanguageInterface::STATE_LOCKED, LanguageInterface::STATE_ALL.
*
* @return array
* @return \Drupal\Core\Language\LanguageInterface[]
* An associative array of languages, keyed by the language code.
*/
public function getLanguages($flags = LanguageInterface::STATE_CONFIGURABLE);
......
......@@ -27,8 +27,8 @@ public function language();
* (optional) Whether the default language should be included. Defaults to
* TRUE.
*
* @return
* An array of language objects, keyed by language codes.
* @return \Drupal\Core\Language\LanguageInterface[]
* An associative array of language objects, keyed by language codes.
*/
public function getTranslationLanguages($include_default = TRUE);
......
......@@ -26,7 +26,7 @@ class FeedLanguageTest extends AggregatorTestBase {
/**
* List of langcodes.
*
* @var array
* @var string[]
*/
protected $langcodes = array();
......@@ -41,7 +41,7 @@ protected function setUp() {
'label' => $this->randomString(),
));
$language->save();
$this->langcodes[$i] = $language;
$this->langcodes[$i] = $language->id();
}
}
......@@ -49,14 +49,15 @@ protected function setUp() {
* Tests creation of feeds with a language.
*/
public function testFeedLanguage() {
/** @var \Drupal\aggregator\FeedInterface[] $feeds */
$feeds = array();
// Create feeds.
$feeds[1] = $this->createFeed(NULL, array('langcode' => $this->langcodes[1]->id));
$feeds[2] = $this->createFeed(NULL, array('langcode' => $this->langcodes[2]->id));
$feeds[1] = $this->createFeed(NULL, array('langcode' => $this->langcodes[1]));
$feeds[2] = $this->createFeed(NULL, array('langcode' => $this->langcodes[2]));
// Make sure that the language has been assigned.
$this->assertEqual($feeds[1]->language()->id, $this->langcodes[1]->id);
$this->assertEqual($feeds[2]->language()->id, $this->langcodes[2]->id);
$this->assertEqual($feeds[1]->language()->id, $this->langcodes[1]);
$this->assertEqual($feeds[2]->language()->id, $this->langcodes[2]);
// Create example nodes to create feed items from and then update the feeds.
$this->createSampleNodes();
......@@ -65,6 +66,7 @@ public function testFeedLanguage() {
// Loop over the created feed items and verify that their language matches
// the one from the feed.
foreach ($feeds as $feed) {
/** @var \Drupal\aggregator\ItemInterface[] $items */
$items = entity_load_multiple_by_properties('aggregator_item', array('fid' => $feed->id()));
$this->assertTrue(count($items) > 0, 'Feed items were created.');
foreach ($items as $item) {
......
......@@ -26,7 +26,18 @@
*/
class PathProcessorTest extends UnitTestCase {
/**
* Configuration for the languageManager stub.
*
* @var \Drupal\Core\Language\LanguageInterface[]
*/
protected $languages;
/**
* The language manager stub used to construct a PathProcessorLanguage object.
*
* @var \Drupal\language\ConfigurableLanguageManagerInterface|\PHPUnit_Framework_MockObject_MockBuilder
*/
protected $languageManager;
protected function setUp() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment