[ Index ]

PHP Cross Reference of Limb3

title

Body

[close]

/web_app/tests/cases/plain/fetcher/ -> lmbFlashBoxFetcherTest.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/web_app/src/fetcher/lmbFlashBoxFetcher.class.php');
  10  lmb_require('limb/web_app/tests/cases/lmbWebAppTestCase.class.php');
  11  
  12  class lmbFlashBoxFetcherTest extends lmbWebAppTestCase
  13  {
  14    function setUp()
  15    {
  16      parent :: setUp();
  17      $this->_cleanUp();
  18    }
  19  
  20    function tearDown()
  21    {
  22      $this->_cleanUp();
  23      parent :: tearDown();
  24    }
  25  
  26    function _cleanUp()
  27    {
  28       $this->toolkit->getFlashBox()->reset();
  29    }
  30  
  31    function testGetDatasetErrorsComeFirst()
  32    {
  33      $this->toolkit->getFlashBox()->addMessage('Message1');
  34      $this->toolkit->getFlashBox()->addError('Error2');
  35  
  36      $fetcher = new lmbFlashBoxFetcher();
  37      $rs = $fetcher->fetch();
  38  
  39      $rs->rewind();
  40      $this->assertFalse($rs->current()->get('is_message'));
  41      $this->assertTrue($rs->current()->get('is_error'));
  42      $this->assertEqual($rs->current()->get('message'), 'Error2');
  43  
  44      $rs->next();
  45      $this->assertTrue($rs->current()->get('is_message'));
  46      $this->assertFalse($rs->current()->get('is_error'));
  47      $this->assertEqual($rs->current()->get('message'), 'Message1');
  48  
  49    }
  50  
  51    function testFetcherResetsMessagesList()
  52    {
  53      $this->toolkit->getFlashBox()->addMessage('Message1');
  54      $this->toolkit->getFlashBox()->addError('Error2');
  55  
  56      $fetcher = new lmbFlashBoxFetcher();
  57      $rs = $fetcher->fetch();
  58  
  59      $rs = $fetcher->fetch();
  60      $rs->rewind();
  61      $this->assertFalse($rs->valid());
  62    }
  63  }
  64  ?>


Generated: Thu Oct 16 04:42:25 2008 Cross-referenced by PHPXref 0.7