More code style fixes

parent 41906695
...@@ -123,7 +123,7 @@ class ArrayStatement implements \IteratorAggregate, ResultStatement ...@@ -123,7 +123,7 @@ class ArrayStatement implements \IteratorAggregate, ResultStatement
return reset($row); return reset($row);
} }
throw new \InvalidArgumentException("Invalid fetch-style given for fetching result."); throw new \InvalidArgumentException('Invalid fetch-style given for fetching result.');
} }
/** /**
......
...@@ -96,7 +96,7 @@ class SQLSrvStatement implements IteratorAggregate, Statement ...@@ -96,7 +96,7 @@ class SQLSrvStatement implements IteratorAggregate, Statement
/** /**
* The fetch style. * The fetch style.
* *
* @param int * @var int
*/ */
private $defaultFetchMode = FetchMode::MIXED; private $defaultFetchMode = FetchMode::MIXED;
......
...@@ -495,9 +495,9 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase ...@@ -495,9 +495,9 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
public function testFetchAssoc() public function testFetchAssoc()
{ {
$statement = 'SELECT * FROM foo WHERE bar = ?'; $statement = 'SELECT * FROM foo WHERE bar = ?';
$params = array(666); $params = [666];
$types = array(ParameterType::INTEGER); $types = [ParameterType::INTEGER];
$result = array(); $result = [];
$driverMock = $this->createMock('Doctrine\DBAL\Driver'); $driverMock = $this->createMock('Doctrine\DBAL\Driver');
...@@ -531,9 +531,9 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase ...@@ -531,9 +531,9 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
public function testFetchArray() public function testFetchArray()
{ {
$statement = 'SELECT * FROM foo WHERE bar = ?'; $statement = 'SELECT * FROM foo WHERE bar = ?';
$params = array(666); $params = [666];
$types = array(ParameterType::INTEGER); $types = [ParameterType::INTEGER];
$result = array(); $result = [];
$driverMock = $this->createMock('Doctrine\DBAL\Driver'); $driverMock = $this->createMock('Doctrine\DBAL\Driver');
...@@ -567,10 +567,10 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase ...@@ -567,10 +567,10 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
public function testFetchColumn() public function testFetchColumn()
{ {
$statement = 'SELECT * FROM foo WHERE bar = ?'; $statement = 'SELECT * FROM foo WHERE bar = ?';
$params = array(666); $params = [666];
$types = array(ParameterType::INTEGER); $types = [ParameterType::INTEGER];
$column = 0; $column = 0;
$result = array(); $result = [];
$driverMock = $this->createMock('Doctrine\DBAL\Driver'); $driverMock = $this->createMock('Doctrine\DBAL\Driver');
...@@ -627,9 +627,9 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase ...@@ -627,9 +627,9 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
public function testFetchAll() public function testFetchAll()
{ {
$statement = 'SELECT * FROM foo WHERE bar = ?'; $statement = 'SELECT * FROM foo WHERE bar = ?';
$params = array(666); $params = [666];
$types = array(ParameterType::INTEGER); $types = [ParameterType::INTEGER];
$result = array(); $result = [];
$driverMock = $this->createMock('Doctrine\DBAL\Driver'); $driverMock = $this->createMock('Doctrine\DBAL\Driver');
......
...@@ -54,26 +54,43 @@ class BlobTest extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -54,26 +54,43 @@ class BlobTest extends \Doctrine\Tests\DbalFunctionalTestCase
public function testSelect() public function testSelect()
{ {
$this->_conn->insert('blob_table', $this->_conn->insert('blob_table', [
array('id' => 1, 'clobfield' => 'test', 'blobfield' => 'test', 'binaryfield' => 'test'), 'id' => 1,
array(ParameterType::INTEGER, ParameterType::STRING, ParameterType::LARGE_OBJECT, ParameterType::LARGE_OBJECT) 'clobfield' => 'test',
); 'blobfield' => 'test',
'binaryfield' => 'test',
], [
ParameterType::INTEGER,
ParameterType::STRING,
ParameterType::LARGE_OBJECT,
ParameterType::LARGE_OBJECT,
]);
$this->assertBlobContains('test'); $this->assertBlobContains('test');
} }
public function testUpdate() public function testUpdate()
{ {
$this->_conn->insert('blob_table', $this->_conn->insert('blob_table', [
array('id' => 1, 'clobfield' => 'test', 'blobfield' => 'test', 'binaryfield' => 'test'), 'id' => 1,
array(ParameterType::INTEGER, ParameterType::STRING, ParameterType::LARGE_OBJECT, ParameterType::LARGE_OBJECT) 'clobfield' => 'test',
); 'blobfield' => 'test',
'binaryfield' => 'test',
$this->_conn->update('blob_table', ], [
array('blobfield' => 'test2', 'binaryfield' => 'test2'), ParameterType::INTEGER,
array('id' => 1), ParameterType::STRING,
array(ParameterType::LARGE_OBJECT, ParameterType::LARGE_OBJECT, ParameterType::INTEGER) ParameterType::LARGE_OBJECT,
); ParameterType::LARGE_OBJECT,
]);
$this->_conn->update('blob_table', [
'blobfield' => 'test2',
'binaryfield' => 'test2',
], ['id' => 1], [
ParameterType::LARGE_OBJECT,
ParameterType::LARGE_OBJECT,
ParameterType::INTEGER,
]);
$this->assertBlobContains('test2'); $this->assertBlobContains('test2');
$this->assertBinaryContains('test2'); $this->assertBinaryContains('test2');
......
...@@ -128,7 +128,7 @@ class PortabilityTest extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -128,7 +128,7 @@ class PortabilityTest extends \Doctrine\Tests\DbalFunctionalTestCase
self::assertArrayHasKey('test_string', $row, "Case should be lowered."); self::assertArrayHasKey('test_string', $row, "Case should be lowered.");
self::assertEquals(3, strlen($row['test_string']), "test_string should be rtrimed to length of three for CHAR(32) column."); self::assertEquals(3, strlen($row['test_string']), "test_string should be rtrimed to length of three for CHAR(32) column.");
self::assertNull($row['test_null']); self::assertNull($row['test_null']);
self::assertArrayNotHasKey(0, $row, "The row should not contain numerical keys."); self::assertArrayNotHasKey(0, $row, 'The row should not contain numerical keys.');
} }
/** /**
......
...@@ -104,9 +104,7 @@ d+N0hqezcjblboJ3Bj8ARJilHX4FAAA= ...@@ -104,9 +104,7 @@ d+N0hqezcjblboJ3Bj8ARJilHX4FAAA=
EOF EOF
); );
$this->_conn->insert('stmt_long_blob', array( $this->_conn->insert('stmt_long_blob', ['contents' => $contents], [ParameterType::LARGE_OBJECT]);
'contents' => $contents,
), array(ParameterType::LARGE_OBJECT));
$stmt = $this->_conn->prepare('SELECT contents FROM stmt_long_blob'); $stmt = $this->_conn->prepare('SELECT contents FROM stmt_long_blob');
$stmt->execute(); $stmt->execute();
......
...@@ -55,8 +55,8 @@ class DBAL630Test extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -55,8 +55,8 @@ class DBAL630Test extends \Doctrine\Tests\DbalFunctionalTestCase
{ {
$this->_conn->executeUpdate( $this->_conn->executeUpdate(
'INSERT INTO dbal630 (bool_col) VALUES(?)', 'INSERT INTO dbal630 (bool_col) VALUES(?)',
array('false'), ['false'],
array(ParameterType::BOOLEAN) [ParameterType::BOOLEAN]
); );
$id = $this->_conn->lastInsertId('dbal630_id_seq'); $id = $this->_conn->lastInsertId('dbal630_id_seq');
self::assertNotEmpty($id); self::assertNotEmpty($id);
......
...@@ -32,10 +32,10 @@ class WriteTest extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -32,10 +32,10 @@ class WriteTest extends \Doctrine\Tests\DbalFunctionalTestCase
public function testExecuteUpdateFirstTypeIsNull() public function testExecuteUpdateFirstTypeIsNull()
{ {
$sql = "INSERT INTO write_table (test_string, test_int) VALUES (?, ?)"; $sql = "INSERT INTO write_table (test_string, test_int) VALUES (?, ?)";
$this->_conn->executeUpdate($sql, array("text", 1111), array(null, ParameterType::INTEGER)); $this->_conn->executeUpdate($sql, ['text', 1111], [null, ParameterType::INTEGER]);
$sql = "SELECT * FROM write_table WHERE test_string = ? AND test_int = ?"; $sql = "SELECT * FROM write_table WHERE test_string = ? AND test_int = ?";
self::assertTrue((bool)$this->_conn->fetchColumn($sql, array("text", 1111))); self::assertTrue((bool) $this->_conn->fetchColumn($sql, ['text', 1111]));
} }
public function testExecuteUpdate() public function testExecuteUpdate()
...@@ -51,8 +51,8 @@ class WriteTest extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -51,8 +51,8 @@ class WriteTest extends \Doctrine\Tests\DbalFunctionalTestCase
$sql = "INSERT INTO write_table (test_int, test_string) VALUES (?, ?)"; $sql = "INSERT INTO write_table (test_int, test_string) VALUES (?, ?)";
$affected = $this->_conn->executeUpdate( $affected = $this->_conn->executeUpdate(
$sql, $sql,
array(1, 'foo'), [1, 'foo'],
array(ParameterType::INTEGER, ParameterType::STRING) [ParameterType::INTEGER, ParameterType::STRING]
); );
self::assertEquals(1, $affected, "executeUpdate() should return the number of affected rows!"); self::assertEquals(1, $affected, "executeUpdate() should return the number of affected rows!");
...@@ -76,7 +76,7 @@ class WriteTest extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -76,7 +76,7 @@ class WriteTest extends \Doctrine\Tests\DbalFunctionalTestCase
$stmt = $this->_conn->prepare($sql); $stmt = $this->_conn->prepare($sql);
$stmt->bindValue(1, 1, ParameterType::INTEGER); $stmt->bindValue(1, 1, ParameterType::INTEGER);
$stmt->bindValue(2, "foo", ParameterType::STRING); $stmt->bindValue(2, 'foo', ParameterType::STRING);
$stmt->execute(); $stmt->execute();
self::assertEquals(1, $stmt->rowCount()); self::assertEquals(1, $stmt->rowCount());
......
...@@ -874,7 +874,10 @@ class QueryBuilderTest extends \Doctrine\Tests\DbalTestCase ...@@ -874,7 +874,10 @@ class QueryBuilderTest extends \Doctrine\Tests\DbalTestCase
$qb->where('is_active = :isActive'); $qb->where('is_active = :isActive');
$qb->setParameter('isActive', true, ParameterType::BOOLEAN); $qb->setParameter('isActive', true, ParameterType::BOOLEAN);
self::assertSame(array('name' => ParameterType::STRING, 'isActive' => ParameterType::BOOLEAN), $qb->getParameterTypes()); self::assertSame([
'name' => ParameterType::STRING,
'isActive' => ParameterType::BOOLEAN,
], $qb->getParameterTypes());
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment