Skip to content

Commit

Permalink
Complete unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Bastien committed Mar 30, 2014
1 parent 9d29919 commit d40f0d5
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 54 deletions.
14 changes: 0 additions & 14 deletions tests/sbp/files/.class.php.container

This file was deleted.

14 changes: 0 additions & 14 deletions tests/sbp/files/.src/ma_classe.class.php

This file was deleted.

23 changes: 0 additions & 23 deletions tests/sbp/files/ma_classe.class.php

This file was deleted.

2 changes: 1 addition & 1 deletion tests/sbp/files/phpunit.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public function testSomeCalcs () {
// be après should devient is pour une conjugaison correcte dans le code
$this->assertTrue(strtolower('ABC') === 'abc', 'strtolower('ABC') should be 'abc'');
// message personnalisé
$this->assertTrue(strtolower('ABC') === 'abc', "strtolower devrait transformer ABC en abc");
$this->assertTrue(strtolower('ABC') === 'abc', "strtolower devrait transformer ABC en abc", 'strtolower('ABC') should be 'abc', "strtolower devrait transformer ABC en abc"');
// be, is et === sont sensibles aux types
$this->assertFalse(7 === "7", '7 should !== be "7"');
}}
14 changes: 12 additions & 2 deletions tests/sbp/spbTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,20 @@ protected function assertParseFile($from, $message = null)
{
$message = "sbp::fileParse(\"$from\") do match the compiled file";
}
$to = str_replace(array("\n", "\r", "\t", ' '), '', trim(file_get_contents($from)));
$from = str_replace(array("\n", "\r", "\t", ' '), '', trim(sbp::testContent(preg_replace('#^(.+)(/[^/]+)$#', '$1/.src$2', $from))));
$out = trim(file_get_contents($from));
$in = trim(sbp::testContent(preg_replace('#^(.+)(/[^/]+)$#', '$1/.src$2', $from)));
$to = str_replace(array("\n", "\r", "\t", ' '), '', $out);
$from = str_replace(array("\n", "\r", "\t", ' '), '', $in);
$to = preg_replace('#/\*.*\*/#U', '', $to);
$from = preg_replace('#/\*.*\*/#U', '', $from);
if($from !== $to)
{
echo "\n\n";
echo htmlspecialchars($in);
echo "\n\n";
echo htmlspecialchars($out);
echo "\n\n";
}
return $this->assertTrue($from === $to, $message);
}

Expand Down

0 comments on commit d40f0d5

Please sign in to comment.