public function test_getLocalVisibilitySetting_celement() { //this time data in DB is tested! $_table = 'tt_content'; $_uid = 1; $visibility = array('0' => 'yes', '1' => t, '2' => ''); $fixture = array('uid' => $_uid, 'tx_languagevisibility_visibility' => serialize($visibility)); $daostub = new tx_languagevisibility_daocommon_stub(); $daostub->stub_setRow($fixture, $_table); $factory = new tx_languagevisibility_elementFactory($daostub); //get element from factory: $element = $factory->getElementForTable($_table, $_uid); //test $this->assertEquals($element->getLocalVisibilitySetting('1'), 't', "t expected"); $this->assertEquals($element->getLocalVisibilitySetting('0'), 'yes', "yes expected"); }
/** * This testcase is used to test that an element from an unsupported table can * not be created. * * @test * @expectedException UnexpectedValueException */ public function canNotGetElementOfUnsupportedTable() { $_uid = 4711; $_table = 'tx_notexisting'; $fixture = array('uid' => $_uid, 'title' => 'record'); $daostub = new tx_languagevisibility_daocommon_stub(); $daostub->stub_setRow($fixture, 'tx_notexisting'); /* @var $factory tx_languagevisibility_elementFactory */ $factory = new tx_languagevisibility_elementFactory($daostub); $element = $factory->getElementForTable($_table, $_uid); $this->assertNull($element, 'Element should be null'); }
function _fixture_getNewsElementWithDefaultVisibility() { //Create the element object fixture. $_table = 'tt_news'; $_uid = 99999; $visibility = array('0' => '-', '1' => '-', '2' => '-'); $fixture = array('uid' => $_uid, 'tx_languagevisibility_visibility' => serialize($visibility), 'tx_languagevisibility_inheritanceflag_original' => 0, 'tx_languagevisibility_inheritanceflag_overlayed' => 0); $daostub = new tx_languagevisibility_daocommon_stub(); $daostub->stub_setRow($fixture, $_table); $factory = new tx_languagevisibility_elementFactory($daostub); //get element from factory: $element = $factory->getElementForTable($_table, $_uid); return $element; }