@@ -84,7 +84,7 @@ public function testGetTablePrefixWithInjectedPrefix()
84
84
85
85
public function testGetTablePrefix ()
86
86
{
87
- $ this ->deploymentConfigMock ->expects (self :: once ())
87
+ $ this ->deploymentConfigMock ->expects ($ this -> once ())
88
88
->method ('get ' )
89
89
->with (ConfigOptionsListConstants::CONFIG_PATH_DB_PREFIX )
90
90
->willReturn ('pref_ ' );
@@ -93,10 +93,10 @@ public function testGetTablePrefix()
93
93
94
94
public function testGetConnectionByName ()
95
95
{
96
- $ this ->deploymentConfigMock ->expects (self :: once ())->method ('get ' )
96
+ $ this ->deploymentConfigMock ->expects ($ this -> once ())->method ('get ' )
97
97
->with (ConfigOptionsListConstants::CONFIG_PATH_DB_CONNECTIONS . '/default ' )
98
98
->willReturn (['config ' ]);
99
- $ this ->connectionFactoryMock ->expects (self :: once ())->method ('create ' )
99
+ $ this ->connectionFactoryMock ->expects ($ this -> once ())->method ('create ' )
100
100
->with (['config ' ])
101
101
->willReturn ('connection ' );
102
102
@@ -112,15 +112,38 @@ public function testGetExistingConnectionByName()
112
112
'connections ' => ['default_process_ ' . getmypid () => 'existing_connection ' ]
113
113
]
114
114
);
115
- $ this ->deploymentConfigMock ->expects (self :: never ())->method ('get ' );
115
+ $ this ->deploymentConfigMock ->expects ($ this -> never ())->method ('get ' );
116
116
117
117
self ::assertEquals ('existing_connection ' , $ unit ->getConnectionByName ('default ' ));
118
118
}
119
119
120
120
public function testCloseConnection ()
121
121
{
122
- $ this ->configMock ->expects (self :: once ())->method ('getConnectionName ' )->with ('default ' );
122
+ $ this ->configMock ->expects ($ this -> once ())->method ('getConnectionName ' )->with ('default ' );
123
123
124
124
$ this ->unit ->closeConnection ('default ' );
125
125
}
126
+
127
+ public function testGetTableNameWithBoolParam ()
128
+ {
129
+ $ this ->deploymentConfigMock ->expects ($ this ->at (0 ))
130
+ ->method ('get ' )
131
+ ->with (ConfigOptionsListConstants::CONFIG_PATH_DB_PREFIX )
132
+ ->willReturn ('pref_ ' );
133
+ $ this ->deploymentConfigMock ->expects ($ this ->at (1 ))->method ('get ' )
134
+ ->with ('db/connection/default ' )
135
+ ->willReturn (['config ' ]);
136
+ $ this ->configMock ->expects ($ this ->atLeastOnce ())
137
+ ->method ('getConnectionName ' )
138
+ ->with ('default ' )
139
+ ->willReturn ('default ' );
140
+
141
+ $ connection = $ this ->getMockBuilder (\Magento \Framework \DB \Adapter \AdapterInterface::class)->getMock ();
142
+ $ connection ->expects ($ this ->once ())->method ('getTableName ' )->with ('pref_1 ' );
143
+ $ this ->connectionFactoryMock ->expects ($ this ->once ())->method ('create ' )
144
+ ->with (['config ' ])
145
+ ->willReturn ($ connection );
146
+
147
+ $ this ->unit ->getTableName (true );
148
+ }
126
149
}
0 commit comments