From adad6ca280f2284a0ea4a1c41c8adea4ae1b141a Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Thu, 27 Aug 2015 13:27:29 +0200 Subject: clean up app container --- tests/unit/db/MapperFactoryTest.php | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) (limited to 'tests') diff --git a/tests/unit/db/MapperFactoryTest.php b/tests/unit/db/MapperFactoryTest.php index cb84e78f5..341dea0e9 100644 --- a/tests/unit/db/MapperFactoryTest.php +++ b/tests/unit/db/MapperFactoryTest.php @@ -13,38 +13,37 @@ namespace OCA\News\Db; +use PHPUnit_Framework_TestCase; -class MapperFactoryTest extends \PHPUnit_Framework_TestCase { +use OCP\IDb; + +use OCA\News\Db\Mysql\ItemMapper as MysqlMapper; + + +class MapperFactoryTest extends PHPUnit_Framework_TestCase { private $db; private $settings; public function setUp() { - $this->db = $this->getMockBuilder('\OCP\IDb') + $this->db = $this->getMockBuilder(IDb::class) ->disableOriginalConstructor() ->getMock(); } - public function testGetItemMapperSqlite() { - $factory = new MapperFactory('sqlite', $this->db); - - $this->assertTrue($factory->getItemMapper() instanceof ItemMapper); + $factory = new MapperFactory($this->db, 'sqlite'); + $this->assertTrue($factory->build() instanceof ItemMapper); } - public function testGetItemMapperPostgres() { - $factory = new MapperFactory('pgsql', $this->db); - - $this->assertTrue($factory->getItemMapper() instanceof ItemMapper); + $factory = new MapperFactory($this->db, 'pgsql'); + $this->assertTrue($factory->build() instanceof ItemMapper); } - public function testGetItemMapperMysql() { - $factory = new MapperFactory('mysql', $this->db); - - $this->assertTrue($factory->getItemMapper() instanceof \OCA\News\Db\Mysql\ItemMapper); + $factory = new MapperFactory($this->db, 'mysql'); + $this->assertTrue($factory->build() instanceof MysqlMapper); } - -} \ No newline at end of file +} -- cgit v1.2.3