* * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ namespace LimberRecord\Adapters; require_once "limber_record/adapters/base.php"; describe("Base adapter", function ($spec) { $spec->it("should throw exception if try to connect with invalid data", function ($spec) { try { $adapter = new MockAdapter(); $adapter->connect("localhost", "root", "wrong"); $adapter->force_connection(); $spec(true)->should->be(false); } catch (ConnectionException $ex) { $spec(true)->should->be(true); } }); $spec->context("delaying connection", function ($spec) { $spec->before_each(function ($data) { $data->adapter = new MockAdapter(); $data->adapter->connect("localhost", "root", "password"); }); $spec->it("should not connect if no query given", function ($spec, $data) { $spec($data->adapter->is_connected)->should->be(false); });
/** * @covers \SmsZilla\Adapter\AbstractAdapter::getParams() * @expectedException \InvalidArgumentException * @expectedExceptionMessage Paramater $params must be an array. */ public function testSetParam() { $this->object->setParams('no_param'); }