<?php

require_once('tests/php/base.php');

class SyntaxTests extends UnitTestCase {
    public function testFrameworkSyntax() {
        $test_files = glob("{framework/php/cashmusic.php,framework/php/*/*.php,framework/php/classes/*/*.php}", GLOB_BRACE);
        foreach ($test_files as $file){
            system("php -l $file", $code);
            $this->assertTrue($code == 0);
        }
    }
    public function testInstallerSyntax() {
        $test_files = glob("installers/php/*.php");
        foreach ($test_files as $file){
            system("php -l $file", $code);
            $this->assertTrue($code == 0);
        }
    }
    public function testInterfaceSyntax() {
        $test_files = glob("{interfaces/php/*/*.php,interfaces/php/*/*/*.php,interfaces/php/*/*/*/*.php,interfaces/php/*/*/*/*/*.php}", GLOB_BRACE);
        foreach ($test_files as $file){
            system("php -l $file", $code);
            $this->assertTrue($code == 0);
        }
    }
}
?>

<?php

require_once('tests/php/base.php');


class SyntaxTests extends UnitTestCase {
    public function checkSyntax($file) {
        $output = exec("php -l $file", $array, $code);
        $this->assertTrue($code == 0, $output);
    }

    public function testFrameworkSyntax() {
        $test_files = glob("{framework/php/cashmusic.php,framework/php/*/*.php,framework/php/classes/*/*.php}", GLOB_BRACE);
        foreach ($test_files as $file){
            $this->checkSyntax($file);
        }
    }
    public function testInstallerSyntax() {
        $test_files = glob("installers/php/*.php");
        foreach ($test_files as $file){
            $this->checkSyntax($file);
        }
    }
    public function testInterfaceSyntax() {
        $test_files = glob("{interfaces/php/*/*.php,interfaces/php/*/*/*.php,interfaces/php/*/*/*/*.php,interfaces/php/*/*/*/*/*.php}", GLOB_BRACE);
        foreach ($test_files as $file){
            $this->checkSyntax($file);
        }
    }
}
?>

Refactor some duplicate code into a checkSyntax function which isn't as noisy
Refactor some duplicate code into a checkSyntax function which isn't as noisy
