File tree Expand file tree Collapse file tree 2 files changed +45
-29
lines changed
Expand file tree Collapse file tree 2 files changed +45
-29
lines changed Original file line number Diff line number Diff line change 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+ }
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments