PHP Classes

File: testing/tests/TestSpaceAroundExclamationMark.php

Recommend this page to a friend!
  Classes of Subin Siby   PHPF   testing/tests/TestSpaceAroundExclamationMark.php   Download  
File: testing/tests/TestSpaceAroundExclamationMark.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: 702 bytes
 

Contents

Class file image Download
<?php

class TestSpaceAroundExclamationMark extends PHPUnit_Framework_TestCase {

   
/**
     * @var string Code to test
     */
   
private $code = <<<CODE
<?php
if (!true) foo();
if ( ! \$foo)
?>
CODE;

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

       
$this->assertContains( 'if ( ! true)', $output );
       
$this->assertContains( 'if ( ! $foo)', $output );
    }

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

       
$this->assertContains( 'if (!true)', $output );
       
$this->assertContains( 'if (!$foo)', $output );
    }

}