PHP Classes

File: testing/tests/TestSpaceAroundParentheses.php

Recommend this page to a friend!
  Classes of Subin Siby   PHPF   testing/tests/TestSpaceAroundParentheses.php   Download  
File: testing/tests/TestSpaceAroundParentheses.php
Role: Unit test script
Content type: text/plain
Description: Unit test script
Class: PHPF
Reformat PHP scripts according to code style
Author: By
Last change:
Date: 7 years ago
Size: 808 bytes
 

Contents

Class file image Download
<?php

class TestSpaceAroundParentheses extends PHPUnit_Framework_TestCase {

   
/**
     * @var string Code to test
     */
   
private $code = <<<CODE
<?php
foo('a.php');
foo();
array(
    'a' => array(
        1, 2,
    ),
);
?>
CODE;

    public function
testEnabled() {
       
$output = executeCommand(
            array(
               
'--passes' => 'SpaceAroundParentheses',
            ),
           
$this->code
       
);

       
$this->assertContains( "foo( 'a.php' );", $output );
       
$this->assertContains( 'foo();', $output );
       
$this->assertContains(
            <<<CODE
array(
    'a' => array(
        1, 2,
    ),
);
CODE
            ,
$output
       
);
    }

    public function
testDisabled() {
       
$output = executeCommand(
            array(
               
'--exclude' => 'SpaceAroundParentheses',
            ),
           
$this->code
       
);

       
$this->assertContains( "foo('a.php');", $output );
       
$this->assertContains( "foo();", $output );
    }

}