Skip to content
Permalink
Browse files

Use typehinting instead of throwing exception.

  • Loading branch information...
ADmad committed Mar 30, 2015
1 parent a3bbb12 commit 1bd14cae108f61d94a30977af0eff77eeb2d3f5f
Showing with 1 addition and 18 deletions.
  1. +1 −5 src/ORM/Table.php
  2. +0 −13 tests/TestCase/ORM/TableTest.php
@@ -393,16 +393,12 @@ public function registryAlias($registryAlias = null)
* @param \Cake\Database\Connection|null $conn The new connection instance
* @return \Cake\Database\Connection
*/
public function connection($conn = null)
public function connection(Connection $conn = null)
{
if ($conn === null) {
return $this->_connection;
}
if (!($conn instanceof Connection)) {
throw new RuntimeException('$conn must be an instance of \Cake\Database\Connection');
}
return $this->_connection = $conn;
}
@@ -185,19 +185,6 @@ public function testConnection()
$this->assertSame($this->connection, $table->connection());
}
/**
* Tests exception is thrown in connection is not instance of
* \Cake\Database\Connection
*
* @expectedException \RuntimeException
* @expectedExceptionMessage $conn must be an instance of \Cake\Database\Connection
* @return void
*/
public function testConnectionException()
{
$table = new Table(['table' => 'users', 'connection' => 'default']);
}
/**
* Tests primaryKey method
*

0 comments on commit 1bd14ca

Please sign in to comment.
You can’t perform that action at this time.