You are here

public function ContentLanguageAccessTestCase::testContentLanguageAccess in Content Language Access 7

Same name and namespace in other branches
  1. 6 content_language_access.test \ContentLanguageAccessTestCase::testContentLanguageAccess()

Tests each content in each language.

File

./content_language_access.test, line 149
Test suite for content language access module.

Class

ContentLanguageAccessTestCase
Defines the content language access test class.

Code

public function testContentLanguageAccess() {
  $this
    ->drupalLogin($this->visitor);
  $languages = $this
    ->getLanguageList(FALSE);
  foreach ($this->nodes as $node) {
    $translation_enabled = locale_multilingual_node_type($node->type);
    foreach ($languages as $language) {
      if ($language->prefix) {
        $prefix = $language->prefix . '/';
      }
      else {
        $prefix = '';
      }
      $this
        ->drupalGet($prefix . 'node/' . $node->nid);
      if (!$translation_enabled || !$node->language || $node->language == LANGUAGE_NONE || $node->language == $language->language) {
        $this
          ->assertResponse(200);
      }
      else {
        $this
          ->assertResponse(403);
      }
    }
  }
}