File: tests/Tests.php

Recommend this page to a friend!
  Classes of Max Base  >  PHP Auto Style Fixer  >  tests/Tests.php  >  Download  
File: tests/Tests.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Auto Style Fixer
Beautify PHP source code fixing its style
Author: By
Last change: Improve Tests.php / #5
Date: 10 months ago
Size: 786 bytes
 

Contents

Class file image Download
<?php
// https://github.com/BaseMax/PHPAS
include "../PHPAS.php";

$dir = './php/';
if(
$files = opendir($dir)) {
   
$index=1;
    while(
false !== ($file = readdir($files))) {
        if(
$file != "." && $file != "..") {
           
$AS=new PHPAutoStyle();
           
$AS->loadFile($dir . $file);
           
$output_filename="output/". $file;
            if(
file_exists($output_filename)) {
               
$output=file_get_contents($output_filename);
               
// $output=trim($output);
               
print "-> $index / $file => ";
               
file_put_contents($output_filename.".tmp", $AS->result);
               
// if(strcmp($AS->result, $output) === 0) {
               
if($AS->result == $output) {
                    print
"TRUE";
                }
                else {
                    print
"FALSE";
                }
                print
"\n";
            }
            else {
                print
"-> $output_filename not exists!\n";
            }
           
$index++;
        }
    }
   
closedir($files);
}

For more information send a message to info at phpclasses dot org.