Passage en Namespace et tous les tests fonctionnels OK
This commit is contained in:
@@ -1,12 +1,21 @@
|
||||
<?php
|
||||
/** DomFramework - Tests
|
||||
* @package domframework
|
||||
* @author Dominique Fournier <dominique@fournier38.fr>
|
||||
* @license BSD
|
||||
*/
|
||||
|
||||
namespace Domframework\Tests;
|
||||
|
||||
use Domframework\Fts;
|
||||
|
||||
/** Test the FTS */
|
||||
class ftsTest extends \PHPUnit_Framework_TestCase
|
||||
class FtsTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function test_tokenizerSearch0 ()
|
||||
{
|
||||
// Empty
|
||||
$fts = new fts ();
|
||||
$fts = new Fts ();
|
||||
$fts->search ("");
|
||||
$res = $fts->getTokensMin ();
|
||||
$this->assertSame ($res, array ("tokens"=>array (),
|
||||
@@ -16,7 +25,7 @@ class ftsTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_tokenizerSearch1 ()
|
||||
{
|
||||
// Too small
|
||||
$fts = new fts ();
|
||||
$fts = new Fts ();
|
||||
$fts->search ("X");
|
||||
$res = $fts->getTokensMin ();
|
||||
$this->assertSame ($res, array ("tokens"=>array (),
|
||||
@@ -26,7 +35,7 @@ class ftsTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_tokenizerSearch2 ()
|
||||
{
|
||||
// One word
|
||||
$fts = new fts ();
|
||||
$fts = new Fts ();
|
||||
$fts->search ("XYZ");
|
||||
$res = $fts->getTokensMin ();
|
||||
$this->assertSame ($res, array ("tokens"=>array ("XYZ"),
|
||||
@@ -36,7 +45,7 @@ class ftsTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_tokenizerSearch3 ()
|
||||
{
|
||||
// Two word
|
||||
$fts = new fts ();
|
||||
$fts = new Fts ();
|
||||
$fts->search ("XYZ 123");
|
||||
$res = $fts->getTokensMin ();
|
||||
$this->assertSame ($res, array ("tokens"=>array ("XYZ", "123"),
|
||||
@@ -46,7 +55,7 @@ class ftsTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_tokenizerSearch4 ()
|
||||
{
|
||||
// Three word
|
||||
$fts = new fts ();
|
||||
$fts = new Fts ();
|
||||
$fts->search ("XYZ 123 ABC");
|
||||
$res = $fts->getTokensMin ();
|
||||
$this->assertSame ($res, array ("tokens"=>array ("XYZ", "123", "ABC"),
|
||||
@@ -56,7 +65,7 @@ class ftsTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_tokenizerSearch5 ()
|
||||
{
|
||||
// Three word
|
||||
$fts = new fts ();
|
||||
$fts = new Fts ();
|
||||
$fts->search ("XYZ 123 ABC KLM");
|
||||
$res = $fts->getTokensMin ();
|
||||
$this->assertSame ($res, array ("tokens"=>array ("XYZ", "123",
|
||||
@@ -67,7 +76,7 @@ class ftsTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_tokenizerSearch6 ()
|
||||
{
|
||||
// Three word
|
||||
$fts = new fts ();
|
||||
$fts = new Fts ();
|
||||
$fts->search ("Louis-XYZ 123 -AéBCé KLM");
|
||||
$res = $fts->getTokensMin ();
|
||||
$this->assertSame ($res, array ("tokens"=>array ("Louis-XYZ", "123",
|
||||
@@ -79,7 +88,7 @@ class ftsTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_tokenizerSentence0 ()
|
||||
{
|
||||
// Empty sentence
|
||||
$fts = new fts ();
|
||||
$fts = new Fts ();
|
||||
$fts->search ("\"\"");
|
||||
$res = $fts->getTokensMin ();
|
||||
$this->assertSame ($res, array ("tokens"=>array (),
|
||||
@@ -89,7 +98,7 @@ class ftsTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_tokenizerSentence1 ()
|
||||
{
|
||||
// One sentence only
|
||||
$fts = new fts ();
|
||||
$fts = new Fts ();
|
||||
$fts->search ("\"XYZ 123\"");
|
||||
$res = $fts->getTokensMin ();
|
||||
$this->assertSame ($res, array ("tokens"=>array ("XYZ 123"),
|
||||
@@ -99,7 +108,7 @@ class ftsTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_tokenizerSentence2 ()
|
||||
{
|
||||
// Two sentence
|
||||
$fts = new fts ();
|
||||
$fts = new Fts ();
|
||||
$fts->search ("\"XYZ 123\" \"ABC KLM\"");
|
||||
$res = $fts->getTokensMin ();
|
||||
$this->assertSame ($res, array ("tokens"=>array ("XYZ 123", "ABC KLM"),
|
||||
@@ -109,7 +118,7 @@ class ftsTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_tokenizerSentence3 ()
|
||||
{
|
||||
// Three sentence
|
||||
$fts = new fts ();
|
||||
$fts = new Fts ();
|
||||
$fts->search ("\"XYZ 123\" -\"ABC KLM\" \"RPO YUI\"");
|
||||
$res = $fts->getTokensMin ();
|
||||
$this->assertSame ($res, array ("tokens"=>array ("XYZ 123", "ABC KLM",
|
||||
@@ -120,7 +129,7 @@ class ftsTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_tokenizerMixed1 ()
|
||||
{
|
||||
// One word and one sentence, starting by word
|
||||
$fts = new fts ();
|
||||
$fts = new Fts ();
|
||||
$fts->search ("XYZ \"ABC KLM\"");
|
||||
$res = $fts->getTokensMin ();
|
||||
$this->assertSame ($res, array ("tokens"=>array ("XYZ", "ABC KLM"),
|
||||
@@ -130,7 +139,7 @@ class ftsTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_tokenizerMixed2 ()
|
||||
{
|
||||
// One word and one sentence, starting by sentence
|
||||
$fts = new fts ();
|
||||
$fts = new Fts ();
|
||||
$fts->search ("\"ABC KLM\" XYZ");
|
||||
$res = $fts->getTokensMin ();
|
||||
$this->assertSame ($res, array ("tokens"=>array ("ABC KLM", "XYZ"),
|
||||
@@ -140,7 +149,7 @@ class ftsTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_tokenizerMixed3 ()
|
||||
{
|
||||
// One word and two sentences, starting by sentence
|
||||
$fts = new fts ();
|
||||
$fts = new Fts ();
|
||||
$fts->search ("\"ABC KLM\" XYZ \"RPO YUI\"");
|
||||
$res = $fts->getTokensMin ();
|
||||
$this->assertSame ($res, array ("tokens"=>array ("ABC KLM", "XYZ",
|
||||
@@ -151,7 +160,7 @@ class ftsTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_tokenizerMixed4 ()
|
||||
{
|
||||
// Two words and two sentences, starting by sentence
|
||||
$fts = new fts ();
|
||||
$fts = new Fts ();
|
||||
$fts->search ("\"ABC KLM\" XYZ \"RPO YUI\" 123");
|
||||
$res = $fts->getTokensMin ();
|
||||
$this->assertSame ($res, array ("tokens"=>array ("ABC KLM", "XYZ",
|
||||
@@ -162,7 +171,7 @@ class ftsTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_tokenizerMixed5 ()
|
||||
{
|
||||
// Two words and two sentences, starting by a word
|
||||
$fts = new fts ();
|
||||
$fts = new Fts ();
|
||||
$fts->search ("123 \"ABC KLM\" XYZ \"RPO YUI\"");
|
||||
$res = $fts->getTokensMin ();
|
||||
$this->assertSame ($res, array ("tokens"=>array ("123", "ABC KLM",
|
||||
|
||||
Reference in New Issue
Block a user