@@ -84,7 +84,7 @@ public function testGetTablePrefixWithInjectedPrefix()
8484
8585 public function testGetTablePrefix ()
8686 {
87- $ this ->deploymentConfigMock ->expects (self :: once ())
87+ $ this ->deploymentConfigMock ->expects ($ this -> once ())
8888 ->method ('get ' )
8989 ->with (ConfigOptionsListConstants::CONFIG_PATH_DB_PREFIX )
9090 ->willReturn ('pref_ ' );
@@ -93,10 +93,10 @@ public function testGetTablePrefix()
9393
9494 public function testGetConnectionByName ()
9595 {
96- $ this ->deploymentConfigMock ->expects (self :: once ())->method ('get ' )
96+ $ this ->deploymentConfigMock ->expects ($ this -> once ())->method ('get ' )
9797 ->with (ConfigOptionsListConstants::CONFIG_PATH_DB_CONNECTIONS . '/default ' )
9898 ->willReturn (['config ' ]);
99- $ this ->connectionFactoryMock ->expects (self :: once ())->method ('create ' )
99+ $ this ->connectionFactoryMock ->expects ($ this -> once ())->method ('create ' )
100100 ->with (['config ' ])
101101 ->willReturn ('connection ' );
102102
@@ -112,15 +112,38 @@ public function testGetExistingConnectionByName()
112112 'connections ' => ['default_process_ ' . getmypid () => 'existing_connection ' ]
113113 ]
114114 );
115- $ this ->deploymentConfigMock ->expects (self :: never ())->method ('get ' );
115+ $ this ->deploymentConfigMock ->expects ($ this -> never ())->method ('get ' );
116116
117117 self ::assertEquals ('existing_connection ' , $ unit ->getConnectionByName ('default ' ));
118118 }
119119
120120 public function testCloseConnection ()
121121 {
122- $ this ->configMock ->expects (self :: once ())->method ('getConnectionName ' )->with ('default ' );
122+ $ this ->configMock ->expects ($ this -> once ())->method ('getConnectionName ' )->with ('default ' );
123123
124124 $ this ->unit ->closeConnection ('default ' );
125125 }
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+ }
126149}
0 commit comments