More code style fixes

parent 41906695
......@@ -123,7 +123,7 @@ class ArrayStatement implements \IteratorAggregate, ResultStatement
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
/**
* The fetch style.
*
* @param int
* @var int
*/
private $defaultFetchMode = FetchMode::MIXED;
......
......@@ -495,9 +495,9 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
public function testFetchAssoc()
{
$statement = 'SELECT * FROM foo WHERE bar = ?';
$params = array(666);
$types = array(ParameterType::INTEGER);
$result = array();
$params = [666];
$types = [ParameterType::INTEGER];
$result = [];
$driverMock = $this->createMock('Doctrine\DBAL\Driver');
......@@ -531,9 +531,9 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
public function testFetchArray()
{
$statement = 'SELECT * FROM foo WHERE bar = ?';
$params = array(666);
$types = array(ParameterType::INTEGER);
$result = array();
$params = [666];
$types = [ParameterType::INTEGER];
$result = [];
$driverMock = $this->createMock('Doctrine\DBAL\Driver');
......@@ -567,10 +567,10 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
public function testFetchColumn()
{
$statement = 'SELECT * FROM foo WHERE bar = ?';
$params = array(666);
$types = array(ParameterType::INTEGER);
$params = [666];
$types = [ParameterType::INTEGER];
$column = 0;
$result = array();
$result = [];
$driverMock = $this->createMock('Doctrine\DBAL\Driver');
......@@ -627,9 +627,9 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
public function testFetchAll()
{
$statement = 'SELECT * FROM foo WHERE bar = ?';
$params = array(666);
$types = array(ParameterType::INTEGER);
$result = array();
$params = [666];
$types = [ParameterType::INTEGER];
$result = [];
$driverMock = $this->createMock('Doctrine\DBAL\Driver');
......
......@@ -54,26 +54,43 @@ class BlobTest extends \Doctrine\Tests\DbalFunctionalTestCase
public function testSelect()
{
$this->_conn->insert('blob_table',
array('id' => 1, 'clobfield' => 'test', 'blobfield' => 'test', 'binaryfield' => 'test'),
array(ParameterType::INTEGER, ParameterType::STRING, ParameterType::LARGE_OBJECT, ParameterType::LARGE_OBJECT)
);
$this->_conn->insert('blob_table', [
'id' => 1,
'clobfield' => 'test',
'blobfield' => 'test',
'binaryfield' => 'test',
], [
ParameterType::INTEGER,
ParameterType::STRING,
ParameterType::LARGE_OBJECT,
ParameterType::LARGE_OBJECT,
]);
$this->assertBlobContains('test');
}
public function testUpdate()
{
$this->_conn->insert('blob_table',
array('id' => 1, 'clobfield' => 'test', 'blobfield' => 'test', 'binaryfield' => 'test'),
array(ParameterType::INTEGER, ParameterType::STRING, ParameterType::LARGE_OBJECT, ParameterType::LARGE_OBJECT)
);
$this->_conn->update('blob_table',
array('blobfield' => 'test2', 'binaryfield' => 'test2'),
array('id' => 1),
array(ParameterType::LARGE_OBJECT, ParameterType::LARGE_OBJECT, ParameterType::INTEGER)
);
$this->_conn->insert('blob_table', [
'id' => 1,
'clobfield' => 'test',
'blobfield' => 'test',
'binaryfield' => 'test',
], [
ParameterType::INTEGER,
ParameterType::STRING,
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->assertBinaryContains('test2');
......
......@@ -128,7 +128,7 @@ class PortabilityTest extends \Doctrine\Tests\DbalFunctionalTestCase
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::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=
EOF
);
$this->_conn->insert('stmt_long_blob', array(
'contents' => $contents,
), array(ParameterType::LARGE_OBJECT));
$this->_conn->insert('stmt_long_blob', ['contents' => $contents], [ParameterType::LARGE_OBJECT]);
$stmt = $this->_conn->prepare('SELECT contents FROM stmt_long_blob');
$stmt->execute();
......
......@@ -55,8 +55,8 @@ class DBAL630Test extends \Doctrine\Tests\DbalFunctionalTestCase
{
$this->_conn->executeUpdate(
'INSERT INTO dbal630 (bool_col) VALUES(?)',
array('false'),
array(ParameterType::BOOLEAN)
['false'],
[ParameterType::BOOLEAN]
);
$id = $this->_conn->lastInsertId('dbal630_id_seq');
self::assertNotEmpty($id);
......
......@@ -32,10 +32,10 @@ class WriteTest extends \Doctrine\Tests\DbalFunctionalTestCase
public function testExecuteUpdateFirstTypeIsNull()
{
$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 = ?";
self::assertTrue((bool)$this->_conn->fetchColumn($sql, array("text", 1111)));
self::assertTrue((bool) $this->_conn->fetchColumn($sql, ['text', 1111]));
}
public function testExecuteUpdate()
......@@ -51,8 +51,8 @@ class WriteTest extends \Doctrine\Tests\DbalFunctionalTestCase
$sql = "INSERT INTO write_table (test_int, test_string) VALUES (?, ?)";
$affected = $this->_conn->executeUpdate(
$sql,
array(1, 'foo'),
array(ParameterType::INTEGER, ParameterType::STRING)
[1, 'foo'],
[ParameterType::INTEGER, ParameterType::STRING]
);
self::assertEquals(1, $affected, "executeUpdate() should return the number of affected rows!");
......@@ -76,7 +76,7 @@ class WriteTest extends \Doctrine\Tests\DbalFunctionalTestCase
$stmt = $this->_conn->prepare($sql);
$stmt->bindValue(1, 1, ParameterType::INTEGER);
$stmt->bindValue(2, "foo", ParameterType::STRING);
$stmt->bindValue(2, 'foo', ParameterType::STRING);
$stmt->execute();
self::assertEquals(1, $stmt->rowCount());
......
......@@ -874,7 +874,10 @@ class QueryBuilderTest extends \Doctrine\Tests\DbalTestCase
$qb->where('is_active = :isActive');
$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