diff options
Diffstat (limited to 'tests/unit/db/MapperFactoryTest.php')
-rw-r--r-- | tests/unit/db/MapperFactoryTest.php | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/tests/unit/db/MapperFactoryTest.php b/tests/unit/db/MapperFactoryTest.php index 51e70f526..5f07f7cbb 100644 --- a/tests/unit/db/MapperFactoryTest.php +++ b/tests/unit/db/MapperFactoryTest.php @@ -31,42 +31,47 @@ require_once(__DIR__ . "/../../classloader.php"); class MapperFactoryTest extends \PHPUnit_Framework_TestCase { + private $db; + private $settings; public function setUp() { - $this->api = $this->getMockBuilder('\OCA\News\Core\API') + $this->settings = $this->getMockBuilder('\OCA\News\Core\Settings') + ->disableOriginalConstructor() + ->getMock(); + $this->db = $this->getMockBuilder('\OCA\News\Core\Db') ->disableOriginalConstructor() ->getMock(); } public function testGetItemMapperSqlite() { - $this->api->expects($this->once()) + $this->settings->expects($this->once()) ->method('getSystemValue') ->with($this->equalTo('dbtype')) ->will($this->returnValue('sqlite')); - $factory = new MapperFactory($this->api); + $factory = new MapperFactory($this->settings, $this->db); $this->assertTrue($factory->getItemMapper() instanceof ItemMapper); } public function testGetItemMapperMysql() { - $this->api->expects($this->once()) + $this->settings->expects($this->once()) ->method('getSystemValue') ->with($this->equalTo('dbtype')) ->will($this->returnValue('mysql')); - $factory = new MapperFactory($this->api); + $factory = new MapperFactory($this->settings, $this->db); $this->assertTrue($factory->getItemMapper() instanceof ItemMapper); } public function testGetItemMapperPostgres() { - $this->api->expects($this->once()) + $this->settings->expects($this->once()) ->method('getSystemValue') ->with($this->equalTo('dbtype')) ->will($this->returnValue('pgsql')); - $factory = new MapperFactory($this->api); + $factory = new MapperFactory($this->settings, $this->db); $this->assertTrue($factory->getItemMapper() instanceof \OCA\News\Db\Postgres\ItemMapper); } |