Browse Source

Add a new book in the test database. it will allow test for accentuated character search.

master
Sébastien Lucas 10 years ago
parent
commit
28292b83a0
4 changed files with 29 additions and 28 deletions
  1. BIN
      test/BaseWithSomeBooks/metadata.db
  2. +6
    -6
      test/bookTest.php
  3. +2
    -2
      test/pageMultidatabaseTest.php
  4. +21
    -20
      test/pageTest.php

BIN
test/BaseWithSomeBooks/metadata.db View File


+ 6
- 6
test/bookTest.php View File

@@ -50,7 +50,7 @@ class BookTest extends PHPUnit_Framework_TestCase

public function testGetBookCount ()
{
$this->assertEquals (14, Book::getBookCount ());
$this->assertEquals (15, Book::getBookCount ());
}

public function testGetCount ()
@@ -59,7 +59,7 @@ class BookTest extends PHPUnit_Framework_TestCase
$this->assertEquals (2, count($entryArray));

$entryAllBooks = $entryArray [0];
$this->assertEquals ("Alphabetical index of the 14 books", $entryAllBooks->content);
$this->assertEquals ("Alphabetical index of the 15 books", $entryAllBooks->content);

$entryRecentBooks = $entryArray [1];
$this->assertEquals ("50 most recent books", $entryRecentBooks->content);
@@ -170,7 +170,7 @@ class BookTest extends PHPUnit_Framework_TestCase
$config['cops_recentbooks_limit'] = 50;

$entryArray = Book::getAllRecentBooks ();
$this->assertCount (14, $entryArray);
$this->assertCount (15, $entryArray);
}

public function testGetBookById ()
@@ -380,10 +380,10 @@ class BookTest extends PHPUnit_Framework_TestCase

$array = JSONRenderer::getJson ();

$this->assertCount (4, $array);
$this->assertCount (5, $array);
$this->assertEquals ("1 author", $array[0]["title"]);
$this->assertEquals ("Doyle, Arthur Conan", $array[1]["title"]);
$this->assertEquals ("1 series", $array[2]["title"]);
$this->assertEquals ("2 series", $array[2]["title"]);
$this->assertEquals ("D'Artagnan Romances", $array[3]["title"]);

$_GET["query"] = "Macmillan";
@@ -445,7 +445,7 @@ class BookTest extends PHPUnit_Framework_TestCase
$this->assertCount (5, $array);
$this->assertEquals ("Some books", $array[0]["title"]);
$this->assertEquals ("1 author", $array[1]["title"]);
$this->assertEquals ("1 series", $array[2]["title"]);
$this->assertEquals ("2 series", $array[2]["title"]);
$this->assertEquals ("One book", $array[3]["title"]);
$this->assertEquals ("1 book", $array[4]["title"]);



+ 2
- 2
test/pageMultidatabaseTest.php View File

@@ -27,7 +27,7 @@ class PageMultiDatabaseTest extends PHPUnit_Framework_TestCase
$this->assertEquals ($config['cops_title_default'], $currentPage->title);
$this->assertCount (2, $currentPage->entryArray);
$this->assertEquals ("Some books", $currentPage->entryArray [0]->title);
$this->assertEquals ("14 books", $currentPage->entryArray [0]->content);
$this->assertEquals ("15 books", $currentPage->entryArray [0]->content);
$this->assertEquals ("One book", $currentPage->entryArray [1]->title);
$this->assertEquals ("1 book", $currentPage->entryArray [1]->content);
$this->assertFalse ($currentPage->ContainsBook ());
@@ -55,7 +55,7 @@ class PageMultiDatabaseTest extends PHPUnit_Framework_TestCase
$this->assertEquals ("Search result for *art*", $currentPage->title);
$this->assertCount (2, $currentPage->entryArray);
$this->assertEquals ("Some books", $currentPage->entryArray [0]->title);
$this->assertEquals ("10 books", $currentPage->entryArray [0]->content);
$this->assertEquals ("11 books", $currentPage->entryArray [0]->content);
$this->assertEquals ("One book", $currentPage->entryArray [1]->title);
$this->assertEquals ("1 book", $currentPage->entryArray [1]->content);
$this->assertFalse ($currentPage->ContainsBook ());


+ 21
- 20
test/pageTest.php View File

@@ -25,19 +25,19 @@ class PageTest extends PHPUnit_Framework_TestCase
$this->assertEquals ($config['cops_title_default'], $currentPage->title);
$this->assertCount (8, $currentPage->entryArray);
$this->assertEquals ("Authors", $currentPage->entryArray [0]->title);
$this->assertEquals ("Alphabetical index of the 5 authors", $currentPage->entryArray [0]->content);
$this->assertEquals ("Alphabetical index of the 6 authors", $currentPage->entryArray [0]->content);
$this->assertEquals ("Series", $currentPage->entryArray [1]->title);
$this->assertEquals ("Alphabetical index of the 3 series", $currentPage->entryArray [1]->content);
$this->assertEquals ("Alphabetical index of the 4 series", $currentPage->entryArray [1]->content);
$this->assertEquals ("Publishers", $currentPage->entryArray [2]->title);
$this->assertEquals ("Alphabetical index of the 5 publishers", $currentPage->entryArray [2]->content);
$this->assertEquals ("Alphabetical index of the 6 publishers", $currentPage->entryArray [2]->content);
$this->assertEquals ("Tags", $currentPage->entryArray [3]->title);
$this->assertEquals ("Alphabetical index of the 10 tags", $currentPage->entryArray [3]->content);
$this->assertEquals ("Alphabetical index of the 11 tags", $currentPage->entryArray [3]->content);
$this->assertEquals ("Ratings", $currentPage->entryArray [4]->title);
$this->assertEquals ("3 ratings", $currentPage->entryArray [4]->content);
$this->assertEquals ("Languages", $currentPage->entryArray [5]->title);
$this->assertEquals ("Alphabetical index of the single language", $currentPage->entryArray [5]->content);
$this->assertEquals ("Alphabetical index of the 2 languages", $currentPage->entryArray [5]->content);
$this->assertEquals ("All books", $currentPage->entryArray [6]->title);
$this->assertEquals ("Alphabetical index of the 14 books", $currentPage->entryArray [6]->content);
$this->assertEquals ("Alphabetical index of the 15 books", $currentPage->entryArray [6]->content);
$this->assertEquals ("Recent additions", $currentPage->entryArray [7]->title);
$this->assertEquals ("50 most recent books", $currentPage->entryArray [7]->content);
$this->assertFalse ($currentPage->ContainsBook ());
@@ -60,7 +60,7 @@ class PageTest extends PHPUnit_Framework_TestCase
$this->assertCount (3, $currentPage->entryArray);
$this->assertEquals ("Ratings", $currentPage->entryArray [0]->title);
$this->assertEquals ("All books", $currentPage->entryArray [1]->title);
$this->assertEquals ("Alphabetical index of the 14 books", $currentPage->entryArray [1]->content);
$this->assertEquals ("Alphabetical index of the 15 books", $currentPage->entryArray [1]->content);
$this->assertEquals ("Recent additions", $currentPage->entryArray [2]->title);
$this->assertEquals ("50 most recent books", $currentPage->entryArray [2]->content);
$this->assertFalse ($currentPage->ContainsBook ());
@@ -207,7 +207,7 @@ class PageTest extends PHPUnit_Framework_TestCase
$currentPage->InitializeContent ();

$this->assertEquals ("Authors", $currentPage->title);
$this->assertCount (5, $currentPage->entryArray);
$this->assertCount (6, $currentPage->entryArray);
$this->assertEquals ("Carroll, Lewis", $currentPage->entryArray [0]->title);
$this->assertFalse ($currentPage->ContainsBook ());

@@ -217,7 +217,7 @@ class PageTest extends PHPUnit_Framework_TestCase
$currentPage->InitializeContent ();

$this->assertEquals ("Authors", $currentPage->title);
$this->assertCount (4, $currentPage->entryArray);
$this->assertCount (5, $currentPage->entryArray);
$this->assertEquals ("C", $currentPage->entryArray [0]->title);
$this->assertFalse ($currentPage->ContainsBook ());
}
@@ -301,7 +301,7 @@ class PageTest extends PHPUnit_Framework_TestCase
$currentPage->InitializeContent ();

$this->assertEquals ("All books", $currentPage->title);
$this->assertCount (14, $currentPage->entryArray);
$this->assertCount (15, $currentPage->entryArray);
$this->assertEquals ("The Adventures of Sherlock Holmes", $currentPage->entryArray [0]->title);
$this->assertEquals ("Alice's Adventures in Wonderland", $currentPage->entryArray [1]->title);
$this->assertTrue ($currentPage->ContainsBook ());
@@ -328,8 +328,8 @@ class PageTest extends PHPUnit_Framework_TestCase
$currentPage = Page::getPage ($page, $qid, $query, $n);
$currentPage->InitializeContent ();

$this->assertEquals ("2 books starting with C", $currentPage->title);
$this->assertCount (2, $currentPage->entryArray);
$this->assertEquals ("3 books starting with C", $currentPage->title);
$this->assertCount (3, $currentPage->entryArray);
$this->assertEquals ("The Call of the Wild", $currentPage->entryArray [0]->title);
$this->assertTrue ($currentPage->ContainsBook ());
}
@@ -345,7 +345,7 @@ class PageTest extends PHPUnit_Framework_TestCase
$currentPage->InitializeContent ();

$this->assertEquals ("Series", $currentPage->title);
$this->assertCount (3, $currentPage->entryArray);
$this->assertCount (4, $currentPage->entryArray);
$this->assertEquals ("D'Artagnan Romances", $currentPage->entryArray [0]->title);
$this->assertFalse ($currentPage->ContainsBook ());
}
@@ -376,7 +376,7 @@ class PageTest extends PHPUnit_Framework_TestCase
$currentPage->InitializeContent ();

$this->assertEquals ("Publishers", $currentPage->title);
$this->assertCount (5, $currentPage->entryArray);
$this->assertCount (6, $currentPage->entryArray);
$this->assertEquals ("D. Appleton and Company", $currentPage->entryArray [0]->title);
$this->assertFalse ($currentPage->ContainsBook ());
}
@@ -409,7 +409,7 @@ class PageTest extends PHPUnit_Framework_TestCase
$currentPage->InitializeContent ();

$this->assertEquals ("Tags", $currentPage->title);
$this->assertCount (10, $currentPage->entryArray);
$this->assertCount (11, $currentPage->entryArray);
$this->assertEquals ("Action & Adventure", $currentPage->entryArray [0]->title);
$this->assertFalse ($currentPage->ContainsBook ());
}
@@ -441,8 +441,9 @@ class PageTest extends PHPUnit_Framework_TestCase
$currentPage->InitializeContent ();

$this->assertEquals ("Languages", $currentPage->title);
$this->assertCount (1, $currentPage->entryArray);
$this->assertCount (2, $currentPage->entryArray);
$this->assertEquals ("English", $currentPage->entryArray [0]->title);
$this->assertEquals ("French", $currentPage->entryArray [1]->title);
$this->assertFalse ($currentPage->ContainsBook ());
}

@@ -505,8 +506,8 @@ class PageTest extends PHPUnit_Framework_TestCase
$currentPage->InitializeContent ();

$this->assertEquals ("Recent additions", $currentPage->title);
$this->assertCount (14, $currentPage->entryArray);
$this->assertEquals ("Alice's Adventures in Wonderland", $currentPage->entryArray [0]->title);
$this->assertCount (15, $currentPage->entryArray);
$this->assertEquals ("La curée", $currentPage->entryArray [0]->title);
$this->assertTrue ($currentPage->ContainsBook ());

// Test facets
@@ -525,8 +526,8 @@ class PageTest extends PHPUnit_Framework_TestCase
$currentPage->InitializeContent ();

$this->assertEquals ("Recent additions", $currentPage->title);
$this->assertCount (12, $currentPage->entryArray);
$this->assertEquals ("Alice's Adventures in Wonderland", $currentPage->entryArray [0]->title);
$this->assertCount (13, $currentPage->entryArray);
$this->assertEquals ("La curée", $currentPage->entryArray [0]->title);
$this->assertTrue ($currentPage->ContainsBook ());

$_GET["tag"] = NULL;


Loading…
Cancel
Save