/**
  * Situation:
  *
  * We have a page structure like the following:
  *
  *  a (uid 1)
  *  |
  *  +--- b (uid 2)
  *       |
  *       +---- c (uid 3)
  *
  * Page a has the inherited force to no setting (no +) for the
  * language 3. Therefor the element should not be visible.
  *
  * @author Timo Schmidt <*****@*****.**>
  * @test
  */
 public function canDetermineInheritedVisibility()
 {
     $this->importDataSet(dirname(__FILE__) . '/fixtures/canDetermineInheritedVisibility.xml');
     $fixtureLanguageRow = array('uid' => 1, 'tx_languagevisibility_defaultvisibility' => 't');
     $fixtureLanguage = new tx_languagevisibility_language();
     $fixtureLanguage->setData($fixtureLanguageRow);
     $dao = new tx_languagevisibility_daocommon();
     $elementFactory = new tx_languagevisibility_elementFactory($dao);
     $fixtureElement = $elementFactory->getElementForTable('pages', 3);
     $visibilityService = new tx_languagevisibility_visibilityService();
     $visibilityService->setUseInheritance();
     $visibilityResult = true;
     $visibilityResult = $visibilityService->isVisible($fixtureLanguage, $fixtureElement);
     $this->assertFalse($visibilityResult, 'The element should not be visibile because of the inherited force to no setting');
 }
 /**
  * Every element can be tested if it is visible for a given language. In addition a
  * description can be delivered why an element is visible or not.
  *
  * @param void
  * @return void
  * @author Timo Schmidt <*****@*****.**>
  * @test
  */
 public function canGetCorrectVisiblityDescriptionForElementWithInheritedVisibility()
 {
     $this->importDataSet(dirname(__FILE__) . '/fixtures/canGetCorrectVisiblityDescriptionForElementWithInheritedVisibility.xml');
     $language = $this->_getLang(1);
     $service = new tx_languagevisibility_visibilityService();
     $service->setUseInheritance();
     $dao = new tx_languagevisibility_daocommon();
     $factory = new tx_languagevisibility_elementFactory($dao);
     /* @var $element tx_languagevisibility_pageelement*/
     $element = $factory->getElementForTable('pages', 7);
     $visibilityDescription = $service->getVisibilityDescription($language, $element);
     $this->assertEquals('force to no (inherited from uid 5)', $visibilityDescription, 'invalid visibility description of element with inheritance');
 }