PageRenderTime 45ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/tests/php/000_syntax.php

https://github.com/letolabs/DIY
PHP | 31 lines | 22 code | 4 blank | 5 comment | 1 complexity | 91f4b1bc5389a200b8586c5284ef8c90 MD5 | raw file
Possible License(s): BSD-3-Clause, LGPL-2.1
  1. <?php
  2. require_once(dirname(__FILE__) . '/base.php');
  3. class SyntaxTests extends UnitTestCase {
  4. public function checkSyntax($file) {
  5. $output = exec("php -l $file", $array, $code);
  6. $this->assertTrue($code == 0, $output);
  7. }
  8. public function testFrameworkSyntax() {
  9. $test_files = glob("{framework/php/cashmusic.php,framework/php/*/*.php,framework/php/classes/*/*.php}", GLOB_BRACE);
  10. foreach ($test_files as $file){
  11. $this->checkSyntax($file);
  12. }
  13. }
  14. public function testInstallerSyntax() {
  15. $test_files = glob("installers/php/*.php");
  16. foreach ($test_files as $file){
  17. $this->checkSyntax($file);
  18. }
  19. }
  20. public function testInterfaceSyntax() {
  21. $test_files = glob("{interfaces/php/*/*.php,interfaces/php/*/*/*.php,interfaces/php/*/*/*/*.php,interfaces/php/*/*/*/*/*.php}", GLOB_BRACE);
  22. foreach ($test_files as $file){
  23. $this->checkSyntax($file);
  24. }
  25. }
  26. }
  27. ?>