forked from Wavyzz/dolibarr
Add phpunit test
This commit is contained in:
@@ -1881,7 +1881,7 @@ class FunctionsLibTest extends CommonClassTest
|
||||
/**
|
||||
* testFetchObjectByElement
|
||||
*
|
||||
* @return boolean;
|
||||
* @return boolean
|
||||
*/
|
||||
public function testFetchObjectByElement()
|
||||
{
|
||||
@@ -1897,7 +1897,7 @@ class FunctionsLibTest extends CommonClassTest
|
||||
/**
|
||||
* testRoundUpToNextMultiple
|
||||
*
|
||||
* @return void;
|
||||
* @return void
|
||||
*/
|
||||
public function testRoundUpToNextMultiple()
|
||||
{
|
||||
@@ -1921,7 +1921,7 @@ class FunctionsLibTest extends CommonClassTest
|
||||
/**
|
||||
* testNaturalSearch
|
||||
*
|
||||
* @return void;
|
||||
* @return void
|
||||
*/
|
||||
public function testNaturalSearch()
|
||||
{
|
||||
@@ -1957,4 +1957,44 @@ class FunctionsLibTest extends CommonClassTest
|
||||
$s = natural_search("t.field", "KØB", 3); // mode 3 is to provide a list of string separated with coma
|
||||
$this->assertEquals(" AND (t.field IN ('KØB'))", $s);
|
||||
}
|
||||
|
||||
/**
|
||||
* testDolExplodeKeepIfQuotes
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testDolExplodeKeepIfQuotes()
|
||||
{
|
||||
global $db;
|
||||
|
||||
$result = dolExplodeKeepIfQuotes("a b");
|
||||
$this->assertEquals("a", $result[0]);
|
||||
$this->assertEquals("b", $result[1]);
|
||||
|
||||
$result = dolExplodeKeepIfQuotes("'a' 'b'");
|
||||
$this->assertEquals("a", $result[0]);
|
||||
$this->assertEquals("b", $result[1]);
|
||||
|
||||
$result = dolExplodeKeepIfQuotes("a 'b' c");
|
||||
$this->assertEquals("a", $result[0]);
|
||||
$this->assertEquals("b", $result[1]);
|
||||
$this->assertEquals("c", $result[2]);
|
||||
|
||||
$result = dolExplodeKeepIfQuotes("a b'c");
|
||||
$this->assertEquals("a", $result[0]);
|
||||
$this->assertEquals("b'c", $result[1]);
|
||||
|
||||
$result = dolExplodeKeepIfQuotes("a 'b'c");
|
||||
$this->assertEquals("a", $result[0]);
|
||||
$this->assertEquals("b", $result[1]);
|
||||
$this->assertEquals("c", $result[2]);
|
||||
|
||||
$result = dolExplodeKeepIfQuotes("a 'b c'");
|
||||
$this->assertEquals("a", $result[0]);
|
||||
$this->assertEquals("b c", $result[1]);
|
||||
|
||||
//$result = dolExplodeKeepIfQuotes("1 0");
|
||||
//$this->assertEquals("1", $result[0]);
|
||||
//$this->assertEquals("0", $result[1]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user