Source of file FAQTest.php
Size: 1,278 Bytes - Last Modified: 2021-12-24T06:43:37+00:00
/var/www/docs.ssmods.com/process/src/tests/unit/FAQTest.php
1234567891011121314151617181920212223242526272829303132333435363738394041424344 | <?php /** * FAQ Module Unit Tests */ class FAQTest extends SapphireTest { /** * Link() functionality, returns a link to view the detail page for FAQ * @see FAQ::getLink */ public function testLink() { // no controller or object created, shouldn't get a link $faq = new FAQ(); $this->assertEquals('', $faq->getLink()); // object created, should get a link $faq1 = new FAQ(array( 'Question' => 'question 1', 'Answer' => 'Milkyway chocolate bar' )); $faq1->write(); $this->assertNotEquals('', $faq1->getLink()); } /** * Should always get a root category * @see FAQ::getRootCategory */ public function testGetRootCategory() { // get root we assume is set by config $root = FAQ::getRootCategory(); $this->assertTrue($root->exists()); $this->assertEquals('TaxonomyTerm', $root->ClassName); // change config to something we know is not in the taxonomy table Config::inst()->update('FAQ', 'taxonomy_name', 'lolipopRANDOMCategory'); $root = FAQ::getRootCategory(); $this->assertTrue($root->exists()); $this->assertEquals('TaxonomyTerm', $root->ClassName); } } |