Compare commits

...

4 Commits

Author SHA1 Message Date
Dominique FOURNIER
303a188e7c DbLayeroo : error parenthesis 2022-12-13 15:43:43 +01:00
Dominique FOURNIER
d5c5806767 Convert: do not block if the $error is a boolean 2022-12-13 14:40:05 +01:00
Dominique FOURNIER
6ac1889e35 Tests/XdiffTest.php : update the test with Camelcase 2022-12-13 14:38:04 +01:00
Dominique FOURNIER
b852888d61 Dblayeroo and Dblayer {ENGINE} 2022-12-13 14:01:27 +01:00
5 changed files with 29 additions and 27 deletions

View File

@@ -10,7 +10,7 @@ namespace Domframework\Tests;
use Domframework\Dblayer;
class DblayerTest { ENGINE } extends \PHPUnit_Framework_TestCase
class DblayerTest{ENGINE} extends \PHPUnit_Framework_TestCase
{
// Test with column name 'group', 'object', 'where', 'with space'
// Test with table name 'group', 'object', 'where', 'with space'

View File

@@ -10,10 +10,7 @@ namespace Domframework\Tests;
use Domframework\Dblayeroo;
class DblayerooTest
{
ENGINE
} extends \PHPUnit_Framework_TestCase
class DblayerooTest{ENGINE} extends \PHPUnit_Framework_TestCase
{
// Test with column name 'group', 'object', 'where', 'with space'
// Test with table name 'group', 'object', 'where', 'with space'

View File

@@ -11,7 +11,7 @@ namespace Domframework\Tests;
use Domframework\Xdiff;
/** Test the domframework xdiff part */
class xdiffTest extends \PHPUnit_Framework_TestCase
class XdiffTest extends \PHPUnit_Framework_TestCase
{
// Declaration of $string1 and $string2
// {{{
@@ -72,7 +72,7 @@ to this document.
";
// }}}
public function test_diff_normal_1()
public function testDiffNormal1()
{
// Mode normal
$xdiff = new Xdiff();
@@ -102,7 +102,7 @@ to this document.
");
}
public function test_diff_normal_2()
public function testDiffNormal2()
{
// Mode normal
$xdiff = new Xdiff();
@@ -146,7 +146,7 @@ to this document.
");
}
public function test_diff_normal_4()
public function testDiffNormal4()
{
// Mode normal
$xdiff = new Xdiff();
@@ -158,14 +158,14 @@ to this document.
");
}
public function test_diff_normal_5()
public function testDiffNormal5()
{
$xdiff = new Xdiff();
$res = $xdiff->diff("\n", "\n");
$this->assertSame($res, "");
}
public function test_diff_normal_6()
public function testDiffNormal6()
{
$xdiff = new Xdiff();
$res = $xdiff->diff("\n", "");
@@ -173,7 +173,7 @@ to this document.
< \n");
}
public function test_diff_normal_7()
public function testDiffNormal7()
{
$xdiff = new Xdiff();
$res = $xdiff->diff("", "\n");
@@ -181,7 +181,7 @@ to this document.
> \n");
}
public function test_diff_unified_1()
public function testDiffUnified1()
{
// Mode unified
$xdiff = new Xdiff("unified");
@@ -215,7 +215,7 @@ to this document.
");
}
public function test_diff_unified_2()
public function testDiffUnified2()
{
// Mode unified
$xdiff = new Xdiff("unified");
@@ -247,7 +247,7 @@ to this document.
");
}
public function test_diff_unified_3()
public function testDiffUnified3()
{
$xdiff = new Xdiff("unified");
$res = $xdiff->diff("NEWLINE\n", "\n");
@@ -259,7 +259,7 @@ to this document.
");
}
public function test_diff_unified_4()
public function testDiffUnified4()
{
$xdiff = new Xdiff("unified");
$res = $xdiff->diff("\n", "NEWLINE\n");
@@ -271,14 +271,14 @@ to this document.
");
}
public function test_diff_unified_5()
public function testDiffUnified5()
{
$xdiff = new Xdiff("unified");
$res = $xdiff->diff("\n", "\n");
$this->assertSame($res, "");
}
public function test_diff_unified_6()
public function testDiffUnified6()
{
$xdiff = new Xdiff("unified");
$res = $xdiff->diff("\n", "");
@@ -288,7 +288,7 @@ to this document.
-\n");
}
public function test_diff_unified_7()
public function testDiffUnified7()
{
$xdiff = new Xdiff("unified");
$res = $xdiff->diff("", "\n");
@@ -298,7 +298,7 @@ to this document.
+\n");
}
public function test_diffFile_unified_1()
public function testDiffFileUnified1()
{
file_put_contents("/tmp/test_xdiff1", $this->string1);
file_put_contents("/tmp/test_xdiff2", $this->string2);
@@ -330,21 +330,21 @@ to this document.
");
}
public function test_diffFile_unified_2()
public function testDiffFileUnified2()
{
$xdiff = new Xdiff("unified");
$this->setExpectedException();
$res = $xdiff->diffFile("/tmp/test_xdiffNOTEXISTS", "/tmp/test_xdiff2");
}
public function test_diffFile_unified_3()
public function testDiffFileUnified3()
{
$xdiff = new Xdiff("unified");
$this->setExpectedException();
$res = $xdiff->diffFile("/tmp/test_xdiff1", "/tmp/test_xdiffNOTEXISTS");
}
public function test_diffFile_sideBySide_1()
public function testDiffFileSideBySide1()
{
file_put_contents("/tmp/test_xdiff1", $this->string1);
file_put_contents("/tmp/test_xdiff2", $this->string2);

View File

@@ -60,7 +60,12 @@ class Convert
return $inputDate;
}
$errors = $date->getLastErrors();
if ($errors["warning_count"] > 0 || $errors["error_count"] > 0) {
if (
$errors !== false && (
$errors["warning_count"] > 0 ||
$errors["error_count"] > 0
)
) {
if ($exception === true) {
throw new \Exception(
"Invalid date provided or not matching the format",

View File

@@ -1472,11 +1472,11 @@ class Dblayeroo
$this->DBException("Parameter foreign invalid: " .
"parameter 1 is not a string");
}
if (mb_strlen($params[0] > 64)) {
if (mb_strlen($params[0]) > 64) {
$this->DBException("Parameter foreign invalid: " .
"parameter 0 is too long");
}
if (mb_strlen($params[1] > 64)) {
if (mb_strlen($params[1]) > 64) {
$this->DBException("Parameter foreign invalid: " .
"parameter 1 is too long");
}