Add real test with a database. re #96
This commit is contained in:
父節點
a8dccf1ea5
當前提交
650a23c8db
共有 4 個文件被更改,包括 46 次插入 和 3 次删除
|
@ -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__) . "/";
|
二進制
test/metadata.db
Normal file
二進制
test/metadata.db
Normal file
Binary file not shown.
載入中…
Add table
Add a link
Reference in a new issue