Skip to content

Commit ad8ce0a

Browse files
author
neustadt
committed
added functional tests
1 parent 175866a commit ad8ce0a

File tree

2 files changed

+45
-29
lines changed

2 files changed

+45
-29
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
3+
class QueryManagerTests extends Enlight_Components_Test_Controller_TestCase
4+
{
5+
/**
6+
* @var array
7+
*/
8+
private $pluginConfig;
9+
10+
/**
11+
* @var \WbmQueryManager\Services\QueryManagerDb
12+
*/
13+
private $connection;
14+
15+
public function setUp()
16+
{
17+
parent::setUp();
18+
19+
$this->pluginConfig = Shopware()->Container()->get('shopware.plugin.cached_config_reader')->getByPluginName('WbmQueryManager');
20+
$this->connection = Shopware()->Container()->get('wbm_query_manager.db');
21+
$this->dispatch('/');
22+
}
23+
24+
public function testSingleQueryManagerDbService()
25+
{
26+
$singleQuery = $this->connection->query('SELECT 1 as a');
27+
$singleQueryResult = $this->connection->fetchAll($singleQuery);
28+
29+
$this->assertTrue($singleQueryResult[0]['a'] === "1");
30+
}
31+
32+
public function testMultiQueryManagerDbService()
33+
{
34+
$multiQuery = $this->connection->query('SELECT 1 as a; SELECT 2 as b');
35+
$multiQueryResult1 = $this->connection->fetchAll($multiQuery);
36+
37+
$this->assertTrue($multiQueryResult1[0]['a'] === "1");
38+
39+
$multiQuery->next_result();
40+
41+
$multiQueryResult2 = $this->connection->fetchAll($multiQuery);
42+
43+
$this->assertTrue($multiQueryResult2[0]['b'] === "2");
44+
}
45+
}

tests/Functional/QueryManagerTests.php

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)