[ Index ]

PHP Cross Reference of Limb3

title

Body

[close]

/tests_runner/tests/cases/ -> lmbDetachedFixtureTest.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  
  10  require_once(dirname(__FILE__) . '/../common.inc.php');
  11  require_once(dirname(__FILE__) . '/../../src/lmbDetachedFixture.class.php');
  12  
  13  class lmbDetachedFixtureTest extends lmbTestRunnerBase
  14  {
  15    function setUp()
  16    {
  17      $this->_rmdir(LIMB_VAR_DIR);
  18      mkdir(LIMB_VAR_DIR);
  19    }
  20  
  21    function tearDown()
  22    {
  23      $this->_rmdir(LIMB_VAR_DIR);
  24    }
  25  
  26    function testSetupTearDown()
  27    {
  28      file_put_contents(LIMB_VAR_DIR . '/.setup.php', '<?php echo "wow"; ?>');
  29      file_put_contents(LIMB_VAR_DIR . '/.teardown.php', '<?php echo "hey"; ?>');
  30  
  31      $fixture = new lmbDetachedFixture(LIMB_VAR_DIR . '/.setup.php',
  32                                        LIMB_VAR_DIR . '/.teardown.php');
  33  
  34      ob_start();
  35      $fixture->setUp();
  36      $fixture->tearDown();
  37      $str = ob_get_contents();
  38      ob_end_clean();
  39      $this->assertEqual($str, 'wowhey');
  40    }
  41  
  42    function testFixtureCanAccessThisWithoutPHPErrors()
  43    {
  44      file_put_contents(LIMB_VAR_DIR . '/.setup.php', '<?php $this->test = "test"; ?>');
  45      file_put_contents(LIMB_VAR_DIR . '/.teardown.php', '<?php echo $this->test; ?>');
  46  
  47      $fixture = new lmbDetachedFixture(LIMB_VAR_DIR . '/.setup.php',
  48                                        LIMB_VAR_DIR . '/.teardown.php');
  49  
  50      ob_start();
  51  
  52      $old = error_reporting(E_ALL);
  53      $fixture->setUp();
  54      $fixture->tearDown();
  55      error_reporting($old);
  56  
  57      $str = ob_get_contents();
  58      ob_end_clean();
  59      $this->assertEqual($str, 'test');
  60    }
  61  }
  62  ?>


Generated: Tue Dec 2 03:54:09 2008 Cross-referenced by PHPXref 0.7