public function test_accessorsConnection() { /** === Test Data === */ $CONN_NAME = 'connection name'; $CONN = 'connection'; /** === Setup Mocks === */ // $this->_conn = $this->_resource->getConnectionByName($this->_nameConn); $mConn = $this->_mockConn(); $this->mResource->shouldReceive('getConnectionByName')->once()->andReturn($mConn); /** === Call and asserts === */ $res = $this->obj->getConnection($CONN_NAME); $this->assertTrue($res instanceof \Magento\Framework\DB\Adapter\AdapterInterface); $this->obj->setConnection($CONN); $res = $this->obj->getConnection(); $this->assertEquals($CONN, $res); }