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

NamespaceTest.php (2560B)


      1 <?php
      2 /*
      3  * This file is part of the PHP_TokenStream package.
      4  *
      5  * (c) Sebastian Bergmann <sebastian@phpunit.de>
      6  *
      7  * For the full copyright and license information, please view the LICENSE
      8  * file that was distributed with this source code.
      9  */
     10 
     11 /**
     12  * Tests for the PHP_Token_NAMESPACE class.
     13  *
     14  * @package    PHP_TokenStream
     15  * @subpackage Tests
     16  * @author     Sebastian Bergmann <sebastian@phpunit.de>
     17  * @copyright  Sebastian Bergmann <sebastian@phpunit.de>
     18  * @license    http://www.opensource.org/licenses/BSD-3-Clause  The BSD 3-Clause License
     19  * @version    Release: @package_version@
     20  * @link       http://github.com/sebastianbergmann/php-token-stream/
     21  * @since      Class available since Release 1.0.0
     22  */
     23 class PHP_Token_NamespaceTest extends PHPUnit_Framework_TestCase
     24 {
     25     /**
     26      * @covers PHP_Token_NAMESPACE::getName
     27      */
     28     public function testGetName()
     29     {
     30         $tokenStream = new PHP_Token_Stream(
     31           TEST_FILES_PATH . 'classInNamespace.php'
     32         );
     33 
     34         foreach ($tokenStream as $token) {
     35             if ($token instanceof PHP_Token_NAMESPACE) {
     36                 $this->assertSame('Foo\\Bar', $token->getName());
     37             }
     38         }
     39     }
     40 
     41     public function testGetStartLineWithUnscopedNamespace()
     42     {
     43         $tokenStream = new PHP_Token_Stream(TEST_FILES_PATH . 'classInNamespace.php');
     44         foreach($tokenStream as $token) {
     45             if($token instanceOf PHP_Token_NAMESPACE) {
     46                 $this->assertSame(2, $token->getLine());
     47             }
     48         }
     49     }
     50 
     51     public function testGetEndLineWithUnscopedNamespace()
     52     {
     53         $tokenStream = new PHP_Token_Stream(TEST_FILES_PATH . 'classInNamespace.php');
     54         foreach($tokenStream as $token) {
     55             if($token instanceOf PHP_Token_NAMESPACE) {
     56                 $this->assertSame(2, $token->getEndLine());
     57             }
     58         }
     59     }
     60     public function testGetStartLineWithScopedNamespace()
     61     {
     62         $tokenStream = new PHP_Token_Stream(TEST_FILES_PATH . 'classInScopedNamespace.php');
     63         foreach($tokenStream as $token) {
     64             if($token instanceOf PHP_Token_NAMESPACE) {
     65                 $this->assertSame(2, $token->getLine());
     66             }
     67         }
     68     }
     69 
     70     public function testGetEndLineWithScopedNamespace()
     71     {
     72         $tokenStream = new PHP_Token_Stream(TEST_FILES_PATH . 'classInScopedNamespace.php');
     73         foreach($tokenStream as $token) {
     74             if($token instanceOf PHP_Token_NAMESPACE) {
     75                 $this->assertSame(8, $token->getEndLine());
     76             }
     77         }
     78     }
     79 
     80 }