diff options
author | Joas Schilling <coding@schilljs.com> | 2016-10-28 13:48:58 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@statuscode.ch> | 2016-11-02 20:30:37 +0100 |
commit | 2c4035e80679b6ebf8e56d86f88701f3ddb65bec (patch) | |
tree | a1bd0571d1bc4eab25ad28f4120bfae4582de637 /tests/lib/DB | |
parent | cd13f50a3f1fbcae757672b4a471d8fbcf959b08 (diff) | |
download | nextcloud-server-2c4035e80679b6ebf8e56d86f88701f3ddb65bec.tar.gz nextcloud-server-2c4035e80679b6ebf8e56d86f88701f3ddb65bec.zip |
Inject config and logger
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests/lib/DB')
-rw-r--r-- | tests/lib/DB/QueryBuilder/QueryBuilderTest.php | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/tests/lib/DB/QueryBuilder/QueryBuilderTest.php b/tests/lib/DB/QueryBuilder/QueryBuilderTest.php index 3c10d25c535..171b44fe92d 100644 --- a/tests/lib/DB/QueryBuilder/QueryBuilderTest.php +++ b/tests/lib/DB/QueryBuilder/QueryBuilderTest.php @@ -25,7 +25,9 @@ use Doctrine\DBAL\Query\Expression\CompositeExpression; use OC\DB\QueryBuilder\Literal; use OC\DB\QueryBuilder\Parameter; use OC\DB\QueryBuilder\QueryBuilder; +use OC\SystemConfig; use OCP\IDBConnection; +use OCP\ILogger; /** * Class QueryBuilderTest @@ -41,11 +43,19 @@ class QueryBuilderTest extends \Test\TestCase { /** @var IDBConnection */ protected $connection; + /** @var SystemConfig|\PHPUnit_Framework_MockObject_MockObject */ + protected $config; + + /** @var ILogger|\PHPUnit_Framework_MockObject_MockObject */ + protected $logger; + protected function setUp() { parent::setUp(); $this->connection = \OC::$server->getDatabaseConnection(); - $this->queryBuilder = new QueryBuilder($this->connection); + $this->config = $this->createMock(SystemConfig::class); + $this->logger = $this->createMock(ILogger::class); + $this->queryBuilder = new QueryBuilder($this->connection, $this->config, $this->logger); } protected function createTestingRows($appId = 'testFirstResult') { @@ -166,7 +176,9 @@ class QueryBuilderTest extends \Test\TestCase { } public function dataSelect() { - $queryBuilder = new QueryBuilder(\OC::$server->getDatabaseConnection()); + $config = $this->createMock(SystemConfig::class); + $logger = $this->createMock(ILogger::class); + $queryBuilder = new QueryBuilder(\OC::$server->getDatabaseConnection(), $config, $logger); return [ // select('column1') [['configvalue'], ['configvalue' => '99']], @@ -232,7 +244,9 @@ class QueryBuilderTest extends \Test\TestCase { } public function dataSelectAlias() { - $queryBuilder = new QueryBuilder(\OC::$server->getDatabaseConnection()); + $config = $this->createMock(SystemConfig::class); + $logger = $this->createMock(ILogger::class); + $queryBuilder = new QueryBuilder(\OC::$server->getDatabaseConnection(), $config, $logger); return [ ['configvalue', 'cv', ['cv' => '99']], [$queryBuilder->expr()->literal('column1'), 'thing', ['thing' => 'column1']], @@ -301,7 +315,9 @@ class QueryBuilderTest extends \Test\TestCase { } public function dataAddSelect() { - $queryBuilder = new QueryBuilder(\OC::$server->getDatabaseConnection()); + $config = $this->createMock(SystemConfig::class); + $logger = $this->createMock(ILogger::class); + $queryBuilder = new QueryBuilder(\OC::$server->getDatabaseConnection(), $config, $logger); return [ // addSelect('column1') [['configvalue'], ['appid' => 'testFirstResult', 'configvalue' => '99']], |