[ Index ]

PHP Cross Reference of Limb3

title

Body

[close]

/cms/tests/cases/fetcher/ -> lmbCmsNodeBreadcrumbsFetcherTest.class.php (source)

   1  <?php
   2  /*
   3   * Limb PHP Framework
   4   *
   5   * @link http://limb-project.com 
   6   * @copyright  Copyright &copy; 2004-2007 BIT(http://bit-creative.com)
   7   * @license    LGPL http://www.gnu.org/copyleft/lesser.html 
   8   */
   9  lmb_require('limb/cms/src/fetcher/lmbCmsNodeBreadcrumbsFetcher.class.php');
  10  
  11  class lmbCmsNodeBreadcrumbsFetcherTest extends lmbCmsTestCase
  12  {
  13    function _cleanUp()
  14    {
  15      $this->db->delete('class_name');
  16      $this->tree->deleteAll();
  17    }
  18  
  19    function testFetch()
  20    {
  21      $root = $this->_createNode('root');
  22      $folder1 =$this->_createNode('folder1', $root);
  23      $folder2 =$this->_createNode('folder2', $root);
  24      $child1 =$this->_createNode('child1', $folder1);
  25      $child2 =$this->_createNode('child2', $folder1);
  26      $child3 =$this->_createNode('child3', $folder2);
  27  
  28      $this->request->getUri()->reset('http://my.domain/root/folder1/child2');
  29  
  30      $fetcher = new lmbCmsNodeBreadcrumbsFetcher();
  31  
  32      $crumbs = $fetcher->getDataset();
  33  
  34      $this->assertEqual($crumbs->count(), 3);
  35      $crumbs->rewind();
  36      $kid = $crumbs->current();
  37      $this->assertEqual($kid->title, $root->title);
  38      $this->assertEqual($kid->getUrlPath(), '/root');
  39      $crumbs->next();
  40      $kid = $crumbs->current();
  41      $this->assertEqual($kid->title, $folder1->title);
  42      $this->assertEqual($kid->getUrlPath(), '/root/folder1');
  43      $crumbs->next();
  44      $kid = $crumbs->current();
  45      $this->assertEqual($kid->title, $child2->title);
  46      $this->assertEqual($kid->getUrlPath(), '/root/folder1/child2');
  47      $this->assertTrue($kid->is_last);
  48    }
  49  
  50    function testFetchForNonExistingNode()
  51    {
  52      $this->request->getUri()->reset('http://my.domain/root/folder1/child2');
  53  
  54      $fetcher = new lmbCmsNodeBreadcrumbsFetcher();
  55  
  56      $crumbs = $fetcher->getDataset();
  57      $this->assertEqual($crumbs->count(), 0);
  58    }
  59  }
  60  
  61  ?>


Generated: Sat Nov 22 03:48:54 2008 Cross-referenced by PHPXref 0.7