Skip to content
Snippets Groups Projects
Commit 7fd3b1f6 authored by Demian Katz's avatar Demian Katz
Browse files

More test coverage.

parent 662810e5
No related merge requests found
<?php
/**
* Unit tests for Booksite cover loader.
*
* PHP version 5
*
* Copyright (C) Villanova University 2010.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* @category VuFind2
* @package Search
* @author Demian Katz <demian.katz@villanova.edu>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link http://vufind.org
*/
namespace VuFindTest\Content\Covers;
use VuFind\Code\ISBN, VuFind\Content\Covers\Booksite;
/**
* Unit tests for Booksite cover loader.
*
* @category VuFind2
* @package Search
* @author Demian Katz <demian.katz@villanova.edu>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link http://vufind.org
*/
class BooksiteTest extends \PHPUnit_Framework_TestCase
{
/**
* Test cover loading
*
* @return void
*/
public function testValidCoverLoading()
{
$loader = new Booksite('http://base', 'mykey');
$this->assertEquals(
'http://base/poca/content_img?apikey=mykey&ean=9780739313121',
$loader->getUrl(
'mykey', 'small', array('isbn' => new ISBN('0739313126'))
)
);
}
/**
* Test missing ISBN
*
* @return void
*/
public function testMissingIsbn()
{
$loader = new Booksite('http://base', 'mykey');
$this->assertEquals(false, $loader->getUrl('mykey', 'small', array()));
}
}
\ No newline at end of file
<?php
/**
* Unit tests for ContentCafe cover loader.
*
* PHP version 5
*
* Copyright (C) Villanova University 2010.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* @category VuFind2
* @package Search
* @author Demian Katz <demian.katz@villanova.edu>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link http://vufind.org
*/
namespace VuFindTest\Content\Covers;
use VuFind\Code\ISBN, VuFind\Content\Covers\ContentCafe, Zend\Config\Config;
/**
* Unit tests for ContentCafe cover loader.
*
* @category VuFind2
* @package Search
* @author Demian Katz <demian.katz@villanova.edu>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link http://vufind.org
*/
class ContentCafeTest extends \PHPUnit_Framework_TestCase
{
/**
* Test cover loading
*
* @return void
*/
public function testValidCoverLoading()
{
$loader = new ContentCafe(new Config(array('pw' => 'fakepw')));
$this->assertEquals(
'http://contentcafe2.btol.com/ContentCafe/Jacket.aspx?UserID=mykey'
. '&Password=fakepw&Return=1&Type=S&Value=9780739313121&erroroverride=1',
$loader->getUrl(
'mykey', 'small', array('isbn' => new ISBN('0739313126'))
)
);
}
/**
* Test missing ISBN
*
* @return void
*/
public function testMissingIsbn()
{
$loader = new ContentCafe(new Config(array('pw' => 'fakepw')));
$this->assertEquals(false, $loader->getUrl('mykey', 'small', array()));
}
}
\ No newline at end of file
<?php
/**
* Unit tests for LibraryThing cover loader.
*
* PHP version 5
*
* Copyright (C) Villanova University 2010.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* @category VuFind2
* @package Search
* @author Demian Katz <demian.katz@villanova.edu>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link http://vufind.org
*/
namespace VuFindTest\Content\Covers;
use VuFind\Code\ISBN, VuFind\Content\Covers\LibraryThing;
/**
* Unit tests for LibraryThing cover loader.
*
* @category VuFind2
* @package Search
* @author Demian Katz <demian.katz@villanova.edu>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link http://vufind.org
*/
class LibraryThingTest extends \PHPUnit_Framework_TestCase
{
/**
* Test cover loading
*
* @return void
*/
public function testValidCoverLoading()
{
$loader = new LibraryThing();
$this->assertEquals(
'http://covers.librarything.com/devkey/mykey/small/isbn/9780739313121',
$loader->getUrl(
'mykey', 'small', array('isbn' => new ISBN('0739313126'))
)
);
}
/**
* Test missing ISBN
*
* @return void
*/
public function testMissingIsbn()
{
$loader = new LibraryThing();
$this->assertEquals(false, $loader->getUrl('mykey', 'small', array()));
}
}
\ No newline at end of file
<?php
/**
* Unit tests for OpenLibrary cover loader.
*
* PHP version 5
*
* Copyright (C) Villanova University 2010.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* @category VuFind2
* @package Search
* @author Demian Katz <demian.katz@villanova.edu>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link http://vufind.org
*/
namespace VuFindTest\Content\Covers;
use VuFind\Code\ISBN, VuFind\Content\Covers\OpenLibrary;
/**
* Unit tests for OpenLibrary cover loader.
*
* @category VuFind2
* @package Search
* @author Demian Katz <demian.katz@villanova.edu>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link http://vufind.org
*/
class OpenLibraryTest extends \PHPUnit_Framework_TestCase
{
/**
* Test cover loading
*
* @return void
*/
public function testValidCoverLoading()
{
$ol = new OpenLibrary();
$this->assertEquals(
'http://covers.openlibrary.org/b/isbn/9780739313121-S.jpg?default=false',
$ol->getUrl(
'mykey', 'small', array('isbn' => new ISBN('0739313126'))
)
);
}
/**
* Test missing ISBN
*
* @return void
*/
public function testMissingIsbn()
{
$ol = new OpenLibrary();
$this->assertEquals(false, $ol->getUrl('mykey', 'small', array()));
}
}
\ No newline at end of file
<?php
/**
* Unit tests for Summon cover loader.
*
* PHP version 5
*
* Copyright (C) Villanova University 2010.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* @category VuFind2
* @package Search
* @author Demian Katz <demian.katz@villanova.edu>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link http://vufind.org
*/
namespace VuFindTest\Content\Covers;
use VuFind\Code\ISBN, VuFind\Content\Covers\Summon;
/**
* Unit tests for Summon cover loader.
*
* @category VuFind2
* @package Search
* @author Demian Katz <demian.katz@villanova.edu>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link http://vufind.org
*/
class SummonTest extends \PHPUnit_Framework_TestCase
{
/**
* Test cover loading
*
* @return void
*/
public function testValidCoverLoading()
{
$summon = new Summon();
$this->assertEquals(
'http://api.summon.serialssolutions.com/2.0.0/image/isbn/'
. 'mykey/9780739313121/small',
$summon->getUrl(
'mykey', 'small', array('isbn' => new ISBN('0739313126'))
)
);
}
/**
* Test missing ISBN
*
* @return void
*/
public function testMissingIsbn()
{
$summon = new Summon();
$this->assertEquals(false, $summon->getUrl('mykey', 'small', array()));
}
}
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment