Skip to content

Commit

Permalink
Test install function : Fix check directory and remove debug
Browse files Browse the repository at this point in the history
  • Loading branch information
bulton-fr committed Sep 5, 2016
1 parent f676be2 commit 1aaa8aa
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 20 deletions.
8 changes: 4 additions & 4 deletions test/bin/functions.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

function testDirectoryOrFile($dir)
function testDirectoryOrFile($installDir, $dir)
{
echo ' > '.$dir."\n";

echo ' >> Exists ';
if (file_exists($dir)) {
if (!file_exists($installDir.'/'.$dir)) {
echo "\033[1;31m[Fail]\033[0m\n";
exit(1);

Expand All @@ -14,7 +14,7 @@ function testDirectoryOrFile($dir)
echo "\033[1;32m[OK]\033[0m\n";

echo ' >> Readable ';
if (is_readable($dir)) {
if (!is_readable($installDir.'/'.$dir)) {
echo "\033[1;31m[Fail]\033[0m\n";
exit(1);

Expand All @@ -23,7 +23,7 @@ function testDirectoryOrFile($dir)
echo "\033[1;32m[OK]\033[0m\n";

echo ' >> Writable ';
if (is_writable($dir)) {
if (!is_writable($installDir.'/'.$dir)) {
echo "\033[1;31m[Fail]\033[0m\n";
exit(1);

Expand Down
33 changes: 17 additions & 16 deletions test/bin/installFwk.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@

echo $installOutput;

echo `cd $installDir && ls -al`;
//echo "\n";
//echo `cd $installDir && ls -al *`;

echo 'Test output returned by script : ';
if ($installOutput !== $exceptedOutput[$installIndex]) {
Expand All @@ -92,22 +93,22 @@

echo 'Test structure :'."\n";

testDirectoryOrFile('app');
testDirectoryOrFile('app/config');
testDirectoryOrFile('app/config/bfw');
testDirectoryOrFile('app/modules');
testDirectoryOrFile($installDir, 'app');
testDirectoryOrFile($installDir, 'app/config');
testDirectoryOrFile($installDir, 'app/config/bfw');
testDirectoryOrFile($installDir, 'app/modules');

testDirectoryOrFile('src');
testDirectoryOrFile('src/cli');
testDirectoryOrFile('src/controllers');
testDirectoryOrFile('src/modeles');
testDirectoryOrFile('src/view');
testDirectoryOrFile($installDir, 'src');
testDirectoryOrFile($installDir, 'src/cli');
testDirectoryOrFile($installDir, 'src/controllers');
testDirectoryOrFile($installDir, 'src/modeles');
testDirectoryOrFile($installDir, 'src/view');

testDirectoryOrFile('web');
testDirectoryOrFile($installDir, 'web');

testDirectoryOrFile('app/config/bfw/config.php');
testDirectoryOrFile('src/cli/exemple.php');
testDirectoryOrFile('web/index.php');
testDirectoryOrFile('.htaccess');
testDirectoryOrFile('cli.php');
testDirectoryOrFile($installDir, 'app/config/bfw/config.php');
testDirectoryOrFile($installDir, 'src/cli/exemple.php');
testDirectoryOrFile($installDir, 'web/index.php');
testDirectoryOrFile($installDir, '.htaccess');
testDirectoryOrFile($installDir, 'cli.php');
}

0 comments on commit 1aaa8aa

Please sign in to comment.