3
3
* Copyright © Magento, Inc. All rights reserved.
4
4
* See COPYING.txt for license details.
5
5
*/
6
+
6
7
namespace Magento \Framework \DB \Test \Unit \DB \Statement ;
7
8
8
9
use Magento \Framework \DB \Statement \Parameter ;
9
10
use Magento \Framework \DB \Statement \Pdo \Mysql ;
10
11
use PHPUnit \Framework \MockObject \MockObject ;
11
12
use PHPUnit \Framework \TestCase ;
12
13
14
+ /**
15
+ * @inheritdoc
16
+ */
13
17
class MysqlTest extends TestCase
14
18
{
15
19
/**
@@ -38,7 +42,8 @@ class MysqlTest extends TestCase
38
42
public function setUp ()
39
43
{
40
44
$ this ->adapterMock = $ this ->getMockForAbstractClass (
41
- \Zend_Db_Adapter_Abstract::class, [],
45
+ \Zend_Db_Adapter_Abstract::class,
46
+ [],
42
47
'' ,
43
48
false ,
44
49
true ,
@@ -56,7 +61,7 @@ public function setUp()
56
61
$ this ->pdoStatementMock = $ this ->createMock (\PDOStatement::class);
57
62
}
58
63
59
- public function test_executeWithoutParams ()
64
+ public function testExecuteWithoutParams ()
60
65
{
61
66
$ query = 'SET @a=1; ' ;
62
67
$ this ->pdoMock ->expects ($ this ->once ())
@@ -68,13 +73,12 @@ public function test_executeWithoutParams()
68
73
(new Mysql ($ this ->adapterMock , $ query ))->_execute ();
69
74
}
70
75
71
- public function test_executeWhenThrowPDOException ()
76
+ public function testExecuteWhenThrowPDOException ()
72
77
{
73
78
$ this ->expectException (\Zend_Db_Statement_Exception::class);
74
79
$ this ->expectExceptionMessage ('test message, query was: ' );
75
80
$ errorReporting = error_reporting ();
76
81
$ query = 'SET @a=1; ' ;
77
-
78
82
$ this ->pdoMock ->expects ($ this ->once ())
79
83
->method ('prepare ' )
80
84
->with ($ query )
@@ -88,12 +92,9 @@ public function test_executeWhenThrowPDOException()
88
92
(new Mysql ($ this ->adapterMock , $ query ))->_execute ();
89
93
}
90
94
91
- public function test_executeWhenParamsAsPrimitives ()
95
+ public function testExecuteWhenParamsAsPrimitives ()
92
96
{
93
- $ params = [
94
- ':param1 ' => 'value1 ' ,
95
- ':param2 ' => 'value2 ' ,
96
- ];
97
+ $ params = [':param1 ' => 'value1 ' , ':param2 ' => 'value2 ' ];
97
98
$ query = 'UPDATE `some_table1` SET `col1`= \'val1 \' WHERE `param1`= \':param1 \' AND `param2`= \':param2 \'; ' ;
98
99
$ this ->pdoMock ->expects ($ this ->once ())
99
100
->method ('prepare ' )
@@ -108,7 +109,7 @@ public function test_executeWhenParamsAsPrimitives()
108
109
(new Mysql ($ this ->adapterMock , $ query ))->_execute ($ params );
109
110
}
110
111
111
- public function test_executeWhenParamsAsParameterObject ()
112
+ public function testExecuteWhenParamsAsParameterObject ()
112
113
{
113
114
$ param1 = $ this ->createMock (Parameter::class);
114
115
$ param1Value = 'SomeValue ' ;
0 commit comments