gluon-web-remote

Web remote Administration for big size of gluon routers
git clone git://archive.git.mtrnord.blog/MTRNord/gluon-web-remote.git
Log | Files | Refs | README

IncludeTest.php (4015B)


      1 <?php
      2 /**
      3  * php-token-stream
      4  *
      5  * Copyright (c) 2009-2013, Sebastian Bergmann <sebastian@phpunit.de>.
      6  * All rights reserved.
      7  *
      8  * Redistribution and use in source and binary forms, with or without
      9  * modification, are permitted provided that the following conditions
     10  * are met:
     11  *
     12  *   * Redistributions of source code must retain the above copyright
     13  *     notice, this list of conditions and the following disclaimer.
     14  *
     15  *   * Redistributions in binary form must reproduce the above copyright
     16  *     notice, this list of conditions and the following disclaimer in
     17  *     the documentation and/or other materials provided with the
     18  *     distribution.
     19  *
     20  *   * Neither the name of Sebastian Bergmann nor the names of his
     21  *     contributors may be used to endorse or promote products derived
     22  *     from this software without specific prior written permission.
     23  *
     24  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     25  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     26  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
     27  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
     28  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
     29  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
     30  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
     31  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
     32  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     33  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
     34  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     35  * POSSIBILITY OF SUCH DAMAGE.
     36  *
     37  * @package    PHP_TokenStream
     38  * @subpackage Tests
     39  * @author     Laurent Laville <pear@laurent-laville.org>
     40  * @copyright  2009-2013 Sebastian Bergmann <sebastian@phpunit.de>
     41  * @license    http://www.opensource.org/licenses/BSD-3-Clause  The BSD 3-Clause License
     42  * @since      File available since Release 1.0.2
     43  */
     44 
     45 if (!defined('TEST_FILES_PATH')) {
     46     define(
     47       'TEST_FILES_PATH',
     48       dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR .
     49       '_files' . DIRECTORY_SEPARATOR
     50     );
     51 }
     52 
     53 require_once 'PHP/Token/Stream.php';
     54 
     55 /**
     56  * Tests for the PHP_Token_REQUIRE_ONCE, PHP_Token_REQUIRE
     57  * PHP_Token_INCLUDE_ONCE and PHP_Token_INCLUDE_ONCE classes.
     58  *
     59  * @package    PHP_TokenStream
     60  * @subpackage Tests
     61  * @author     Laurent Laville <pear@laurent-laville.org>
     62  * @copyright  2009-2013 Sebastian Bergmann <sebastian@phpunit.de>
     63  * @license    http://www.opensource.org/licenses/BSD-3-Clause  The BSD 3-Clause License
     64  * @version    Release: @package_version@
     65  * @link       http://github.com/sebastianbergmann/php-token-stream/
     66  * @since      Class available since Release 1.0.2
     67  */
     68 class PHP_Token_IncludeTest extends PHPUnit_Framework_TestCase
     69 {
     70     protected $ts;
     71 
     72     protected function setUp()
     73     {
     74         $this->ts = new PHP_Token_Stream(TEST_FILES_PATH . 'source3.php');
     75     }
     76 
     77     /**
     78      * @covers PHP_Token_Includes::getName
     79      * @covers PHP_Token_Includes::getType
     80      */
     81     public function testGetIncludes()
     82     {
     83         $this->assertSame(
     84           array('test4.php', 'test3.php', 'test2.php', 'test1.php'),
     85           $this->ts->getIncludes()
     86         );
     87     }
     88 
     89     /**
     90      * @covers PHP_Token_Includes::getName
     91      * @covers PHP_Token_Includes::getType
     92      */
     93     public function testGetIncludesCategorized()
     94     {
     95         $this->assertSame(
     96           array(
     97             'require_once' => array('test4.php'),
     98             'require'      => array('test3.php'),
     99             'include_once' => array('test2.php'),
    100             'include'      => array('test1.php')
    101           ),
    102           $this->ts->getIncludes(TRUE)
    103         );
    104     }
    105 
    106     /**
    107      * @covers PHP_Token_Includes::getName
    108      * @covers PHP_Token_Includes::getType
    109      */
    110     public function testGetIncludesCategory()
    111     {
    112         $this->assertSame(
    113           array('test4.php'),
    114           $this->ts->getIncludes(TRUE, 'require_once')
    115         );
    116     }
    117 }