diff --git a/src/Client.php b/src/Client.php index 97b296f4b7..121d398914 100644 --- a/src/Client.php +++ b/src/Client.php @@ -52,25 +52,16 @@ class Client public function getDatabases() { - if (!($this->getAdapter() instanceOf QueryableInterface)) { - throw new \BadMethodCallException("You can query the database only if the adapter supports it!"); - } return $this->getAdapter()->query("show databases"); } public function createDatabase($name) { - if (!($this->getAdapter() instanceOf QueryableInterface)) { - throw new \BadMethodCallException("You can query the database only if the adapter supports it!"); - } return $this->getAdapter()->query("create database \"{$name}\""); } public function deleteDatabase($name) { - if (!($this->getAdapter() instanceOf QueryableInterface)) { - throw new \BadMethodCallException("You can query the database only if the adapter supports it!"); - } return $this->getAdapter()->query("drop database \"{$name}\""); } } diff --git a/tests/unit/ClientTest.php b/tests/unit/ClientTest.php index 4cc843af14..da6586ec52 100644 --- a/tests/unit/ClientTest.php +++ b/tests/unit/ClientTest.php @@ -62,4 +62,22 @@ class ClientTest extends \PHPUnit_Framework_TestCase ] ]); } + + /** + * @expectedException BadMethodCallException + */ + public function testNeedWritableInterfaceDuringMark() + { + $client = new Client(new \stdClass()); + $client->mark("OK", []); + } + + /** + * @expectedException BadMethodCallException + */ + public function testNeedQueryableInterfaceDuringQuery() + { + $client = new Client(new \stdClass()); + $client->query("OK", []); + } }