Add real test with a database. re #96
This commit is contained in:
parent
a8dccf1ea5
commit
650a23c8db
|
@ -3,7 +3,7 @@
|
|||
require_once (dirname(__FILE__) . "/config_test.php");
|
||||
require_once (dirname(__FILE__) . "/../base.php");
|
||||
|
||||
class StackTest extends PHPUnit_Framework_TestCase
|
||||
class BaseTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testAddURLParameter ()
|
||||
{
|
||||
|
|
43
test/bookTest.php
Normal file
43
test/bookTest.php
Normal file
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
require_once (dirname(__FILE__) . "/config_test.php");
|
||||
require_once (dirname(__FILE__) . "/../book.php");
|
||||
|
||||
class StackTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testGetBookCount ()
|
||||
{
|
||||
$this->assertEquals (14, Book::getBookCount ());
|
||||
}
|
||||
|
||||
public function testGetCount ()
|
||||
{
|
||||
$entryArray = Book::getCount ();
|
||||
$this->assertEquals (2, count($entryArray));
|
||||
|
||||
$entryAllBooks = $entryArray [0];
|
||||
$this->assertEquals ("Alphabetical index of the 14 books", $entryAllBooks->content);
|
||||
|
||||
$entryRecentBooks = $entryArray [1];
|
||||
$this->assertEquals ("50 most recent books", $entryRecentBooks->content);
|
||||
|
||||
}
|
||||
|
||||
public function testGetCountRecent ()
|
||||
{
|
||||
global $config;
|
||||
$config['cops_recentbooks_limit'] = 0;
|
||||
$entryArray = Book::getCount ();
|
||||
|
||||
$this->assertEquals (1, count($entryArray));
|
||||
|
||||
$config['cops_recentbooks_limit'] = 2;
|
||||
$entryArray = Book::getCount ();
|
||||
|
||||
$entryRecentBooks = $entryArray [1];
|
||||
$this->assertEquals ("2 most recent books", $entryRecentBooks->content);
|
||||
|
||||
$config['cops_recentbooks_limit'] = 50;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
|
||||
$config = array();
|
||||
$config['default_timezone'] = "Europe/Paris";
|
||||
require_once (dirname(__FILE__) . "/../config_default.php");
|
||||
$config['calibre_directory'] = dirname(__FILE__) . "/";
|
BIN
test/metadata.db
Normal file
BIN
test/metadata.db
Normal file
Binary file not shown.
Loading…
Reference in a new issue