Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Adapter/Driver/Oci8/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ public function execute($sql)

/**
* @todo Get Last Generated Value in Connection (this might not apply)
* {@inheritDoc}
* @inheritDoc
*/
public function getLastGeneratedValue($name = null)
{
Expand Down
1 change: 0 additions & 1 deletion src/Sql/Delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ public function from($table): static
}

/**
* @param ?string $key
* @return mixed
*/
public function getRawState(?string $key = null)
Expand Down
2 changes: 0 additions & 2 deletions src/Sql/Predicate/PredicateSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,6 @@ public function addPredicates($predicates, $combination = self::OP_AND)

/**
* Return the predicates
*
* @return array
*/
public function getPredicates(): array
{
Expand Down
4 changes: 2 additions & 2 deletions src/Sql/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class Select extends AbstractPreparableSql
protected bool $prefixColumnsWithTable = true;

/** @var null|string|array|TableIdentifier */
protected $table = null;
protected $table;

/** @var null|string|Expression */
protected $quantifier;
Expand Down Expand Up @@ -239,7 +239,7 @@ public function columns(array $columns, $prefixColumnsWithTable = true)
* Create join clause
*
* @param string|array|TableIdentifier $name
* @param string|Predicate\PredicateInterface $on
* @param string|PredicateInterface $on
* @param string|array $columns
* @param string $type one of the JOIN_* constants
* @return $this Provides a fluent interface
Expand Down
6 changes: 4 additions & 2 deletions test/integration/Adapter/Driver/Pdo/Mysql/AdapterTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ trait AdapterTrait
#[Override]
protected function setUp(): void
{
if (! is_string(getenv('TESTS_LAMINAS_DB_ADAPTER_DRIVER_MYSQL')) ||
strtolower((string) getenv('TESTS_LAMINAS_DB_ADAPTER_DRIVER_MYSQL')) !== 'true') {
if (
! is_string(getenv('TESTS_LAMINAS_DB_ADAPTER_DRIVER_MYSQL')) ||
strtolower((string) getenv('TESTS_LAMINAS_DB_ADAPTER_DRIVER_MYSQL')) !== 'true'
) {
$this->markTestSkipped('pdo_mysql integration tests are not enabled!');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ trait AdapterTrait
#[Override]
protected function setUp(): void
{
if (! is_string(getenv('TESTS_LAMINAS_DB_ADAPTER_DRIVER_PGSQL')) || strtolower(getenv('TESTS_LAMINAS_DB_ADAPTER_DRIVER_PGSQL')) !== 'true') {
if (
! is_string(getenv('TESTS_LAMINAS_DB_ADAPTER_DRIVER_PGSQL'))
|| strtolower(getenv('TESTS_LAMINAS_DB_ADAPTER_DRIVER_PGSQL')) !== 'true'
) {
$this->markTestSkipped('pdo_pgsql integration tests are not enabled!');
}

Expand Down
10 changes: 8 additions & 2 deletions test/unit/Adapter/Driver/IbmDb2/IbmDb2Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ protected function setUp(): void
*/
public function testRegisterConnection(): void
{
$mockConnection = $this->getMockBuilder(Connection::class)->setConstructorArgs([[]])->onlyMethods(['setDriver'])->getMock();
$mockConnection = $this->getMockBuilder(Connection::class)
->setConstructorArgs([[]])
->onlyMethods(['setDriver'])
->getMock();
$mockConnection->expects($this->once())->method('setDriver')->with($this->equalTo($this->ibmdb2));
self::assertSame($this->ibmdb2, $this->ibmdb2->registerConnection($mockConnection));
}
Expand All @@ -53,7 +56,10 @@ public function testRegisterConnection(): void
public function testRegisterStatementPrototype(): void
{
$this->ibmdb2 = new IbmDb2([]);
$mockStatement = $this->getMockBuilder(Statement::class)->setConstructorArgs([])->onlyMethods(['setDriver'])->getMock();
$mockStatement = $this->getMockBuilder(Statement::class)
->setConstructorArgs([])
->onlyMethods(['setDriver'])
->getMock();
$mockStatement->expects($this->once())->method('setDriver')->with($this->equalTo($this->ibmdb2));
self::assertSame($this->ibmdb2, $this->ibmdb2->registerStatementPrototype($mockStatement));
}
Expand Down
15 changes: 12 additions & 3 deletions test/unit/Adapter/Driver/Oci8/Oci8Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ protected function setUp(): void
*/
public function testRegisterConnection(): void
{
$mockConnection = $this->getMockBuilder(Connection::class)->setConstructorArgs([[]])->onlyMethods(['setDriver'])->getMock();
$mockConnection = $this->getMockBuilder(Connection::class)
->setConstructorArgs([[]])
->onlyMethods(['setDriver'])
->getMock();
$mockConnection->expects($this->once())->method('setDriver')->with($this->equalTo($this->oci8));
self::assertSame($this->oci8, $this->oci8->registerConnection($mockConnection));
}
Expand All @@ -52,7 +55,10 @@ public function testRegisterConnection(): void
public function testRegisterStatementPrototype(): void
{
$this->oci8 = new Oci8([]);
$mockStatement = $this->getMockBuilder(Statement::class)->setConstructorArgs([])->onlyMethods(['setDriver'])->getMock();
$mockStatement = $this->getMockBuilder(Statement::class)
->setConstructorArgs([])
->onlyMethods(['setDriver'])
->getMock();
$mockStatement->expects($this->once())->method('setDriver')->with($this->equalTo($this->oci8));
self::assertSame($this->oci8, $this->oci8->registerStatementPrototype($mockStatement));
}
Expand All @@ -63,7 +69,10 @@ public function testRegisterStatementPrototype(): void
public function testRegisterResultPrototype(): void
{
$this->oci8 = new Oci8([]);
$mockStatement = $this->getMockBuilder(Result::class)->setConstructorArgs([])->onlyMethods([])->getMock();
$mockStatement = $this->getMockBuilder(Result::class)
->setConstructorArgs([])
->onlyMethods([])
->getMock();
self::assertSame($this->oci8, $this->oci8->registerResultPrototype($mockStatement));
}

Expand Down
15 changes: 12 additions & 3 deletions test/unit/Adapter/Driver/Pgsql/PgsqlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ public function testCheckEnvironment(): void
*/
public function testRegisterConnection(): void
{
$mockConnection = $this->getMockBuilder(Connection::class)->setConstructorArgs([[]])->onlyMethods(['setDriver'])->getMock();
$mockConnection = $this->getMockBuilder(Connection::class)
->setConstructorArgs([[]])
->onlyMethods(['setDriver'])
->getMock();
$mockConnection->expects($this->once())->method('setDriver')->with($this->equalTo($this->pgsql));
self::assertSame($this->pgsql, $this->pgsql->registerConnection($mockConnection));
}
Expand All @@ -66,7 +69,10 @@ public function testRegisterConnection(): void
public function testRegisterStatementPrototype(): void
{
$this->pgsql = new Pgsql([]);
$mockStatement = $this->getMockBuilder(Statement::class)->setConstructorArgs([])->onlyMethods(['setDriver'])->getMock();
$mockStatement = $this->getMockBuilder(Statement::class)
->setConstructorArgs([])
->onlyMethods(['setDriver'])
->getMock();
$mockStatement->expects($this->once())->method('setDriver')->with($this->equalTo($this->pgsql));
self::assertSame($this->pgsql, $this->pgsql->registerStatementPrototype($mockStatement));
}
Expand All @@ -77,7 +83,10 @@ public function testRegisterStatementPrototype(): void
public function testRegisterResultPrototype(): void
{
$this->pgsql = new Pgsql([]);
$mockStatement = $this->getMockBuilder(Result::class)->setConstructorArgs([])->onlyMethods([])->getMock();
$mockStatement = $this->getMockBuilder(Result::class)
->setConstructorArgs([])
->onlyMethods([])
->getMock();
self::assertSame($this->pgsql, $this->pgsql->registerResultPrototype($mockStatement));
}

Expand Down
10 changes: 8 additions & 2 deletions test/unit/Adapter/Driver/Sqlsrv/SqlsrvTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ protected function setUp(): void
*/
public function testRegisterConnection(): void
{
$mockConnection = $this->getMockBuilder(Connection::class)->setConstructorArgs([[]])->onlyMethods(['setDriver'])->getMock();
$mockConnection = $this->getMockBuilder(Connection::class)
->setConstructorArgs([[]])
->onlyMethods(['setDriver'])
->getMock();
$mockConnection->expects($this->once())->method('setDriver')->with($this->equalTo($this->sqlsrv));
self::assertSame($this->sqlsrv, $this->sqlsrv->registerConnection($mockConnection));
}
Expand All @@ -53,7 +56,10 @@ public function testRegisterConnection(): void
public function testRegisterStatementPrototype(): void
{
$this->sqlsrv = new Sqlsrv([]);
$mockStatement = $this->getMockBuilder(Statement::class)->setConstructorArgs([])->onlyMethods(['setDriver'])->getMock();
$mockStatement = $this->getMockBuilder(Statement::class)
->setConstructorArgs([])
->onlyMethods(['setDriver'])
->getMock();
$mockStatement->expects($this->once())->method('setDriver')->with($this->equalTo($this->sqlsrv));
self::assertSame($this->sqlsrv, $this->sqlsrv->registerStatementPrototype($mockStatement));
}
Expand Down
4 changes: 2 additions & 2 deletions test/unit/Adapter/Platform/PostgresqlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ public function testQuoteValueList(): void
// 'Attempting to quote a value in Laminas\Db\Adapter\Platform\Postgresql without extension/driver'
// . ' support can introduce security vulnerabilities in a production environment'
//);
$fooOBar = $this->platform->quoteTrustedValue("Foo O'Bar");
self::assertEquals($fooOBar, $this->platform->quoteValueList("Foo O'Bar"));
$fooBar = $this->platform->quoteTrustedValue("Foo O'Bar");
self::assertEquals($fooBar, $this->platform->quoteValueList("Foo O'Bar"));
}

public function testGetIdentifierSeparator(): void
Expand Down
6 changes: 4 additions & 2 deletions test/unit/Adapter/Platform/Sql92Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ public function testQuoteValueRaisesNoticeWithoutPlatformSupport(): void
*/
//$this->expectNotice();
//$this->expectExceptionMessage(
// 'Attempting to quote a value without specific driver level support can introduce security vulnerabilities '
// 'Attempting to quote a value without specific driver level '
// . ' support can introduce security vulnerabilities'
// . 'in a production environment.'
//);
$this->expectNotToPerformAssertions();
Expand Down Expand Up @@ -109,7 +110,8 @@ public function testQuoteValueList(): void
*/
//$this->expectError();
//$this->expectExceptionMessage(
// 'Attempting to quote a value without specific driver level support can introduce security vulnerabilities '
// 'Attempting to quote a value without specific driver level '
// . 'support can introduce security vulnerabilities '
// . 'in a production environment.'
//);
self::assertEquals("'Foo O\\'Bar'", $this->platform->quoteValueList("Foo O'Bar"));
Expand Down
6 changes: 4 additions & 2 deletions test/unit/Adapter/Platform/SqlServerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ public function testQuoteValueRaisesNoticeWithoutPlatformSupport(): void
*/
//$this->expectNotice();
//$this->expectExceptionMessage(
// 'Attempting to quote a value in Laminas\Db\Adapter\Platform\SqlServer without extension/driver support can '
// 'Attempting to quote a value in Laminas\Db\Adapter\Platform\SqlServer '
// . 'without extension/driver support can '
// . 'introduce security vulnerabilities in a production environment'
//);
$this->expectNotToPerformAssertions();
Expand Down Expand Up @@ -112,7 +113,8 @@ public function testQuoteValueList(): void
*/
//$this->expectError();
//$this->expectExceptionMessage(
// 'Attempting to quote a value in Laminas\Db\Adapter\Platform\SqlServer without extension/driver support can '
// 'Attempting to quote a value in Laminas\Db\Adapter\Platform\SqlServer '
// . 'without extension/driver support can '
// . 'introduce security vulnerabilities in a production environment'
//);
self::assertEquals("'Foo O''Bar'", $this->platform->quoteValueList("Foo O'Bar"));
Expand Down
6 changes: 5 additions & 1 deletion test/unit/Metadata/Source/AbstractSourceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ final class AbstractSourceTest extends TestCase
#[Override]
protected function setUp(): void
{
$this->abstractSourceMock = $this->getMockBuilder(AbstractSource::class)->setConstructorArgs([])->onlyMethods([])->disableOriginalConstructor()->getMock();
$this->abstractSourceMock = $this->getMockBuilder(AbstractSource::class)
->setConstructorArgs([])
->onlyMethods([])
->disableOriginalConstructor()
->getMock();
}

/**
Expand Down
5 changes: 4 additions & 1 deletion test/unit/RowGateway/AbstractRowGatewayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,10 @@ public function testSaveInsertMultiKey(): void
{
$this->rowGateway = $this->getMockBuilder(AbstractRowGateway::class)->onlyMethods([])->getMock();

$mockSql = $this->getMockBuilder(Sql::class)->setConstructorArgs([$this->mockAdapter])->onlyMethods([])->getMock();
$mockSql = $this->getMockBuilder(Sql::class)
->setConstructorArgs([$this->mockAdapter])
->onlyMethods([])
->getMock();

$rgPropertyValues = [
'primaryKeyColumn' => ['one', 'two'],
Expand Down
15 changes: 12 additions & 3 deletions test/unit/Sql/Ddl/Column/AbstractLengthColumnTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ final class AbstractLengthColumnTest extends TestCase
*/
public function testSetLength(): void
{
$column = $this->getMockBuilder(AbstractLengthColumn::class)->setConstructorArgs(['foo', 55])->onlyMethods([])->getMock();
$column = $this->getMockBuilder(AbstractLengthColumn::class)
->setConstructorArgs(['foo', 55])
->onlyMethods([])
->getMock();
self::assertEquals(55, $column->getLength());
self::assertSame($column, $column->setLength(20));
self::assertEquals(20, $column->getLength());
Expand All @@ -28,7 +31,10 @@ public function testSetLength(): void
*/
public function testGetLength(): void
{
$column = $this->getMockBuilder(AbstractLengthColumn::class)->setConstructorArgs(['foo', 55])->onlyMethods([])->getMock();
$column = $this->getMockBuilder(AbstractLengthColumn::class)
->setConstructorArgs(['foo', 55])
->onlyMethods([])
->getMock();
self::assertEquals(55, $column->getLength());
}

Expand All @@ -37,7 +43,10 @@ public function testGetLength(): void
*/
public function testGetExpressionData(): void
{
$column = $this->getMockBuilder(AbstractLengthColumn::class)->setConstructorArgs(['foo', 4])->onlyMethods([])->getMock();
$column = $this->getMockBuilder(AbstractLengthColumn::class)
->setConstructorArgs(['foo', 4])
->onlyMethods([])
->getMock();

self::assertEquals(
[['%s %s NOT NULL', ['foo', 'INTEGER(4)'], [$column::TYPE_IDENTIFIER, $column::TYPE_LITERAL]]],
Expand Down
25 changes: 20 additions & 5 deletions test/unit/Sql/Ddl/Column/AbstractPrecisionColumnTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ final class AbstractPrecisionColumnTest extends TestCase
*/
public function testSetDigits(): void
{
$column = $this->getMockBuilder(AbstractPrecisionColumn::class)->setConstructorArgs(['foo', 10])->onlyMethods([])->getMock();
$column = $this->getMockBuilder(AbstractPrecisionColumn::class)
->setConstructorArgs(['foo', 10])
->onlyMethods([])
->getMock();
self::assertEquals(10, $column->getDigits());
self::assertSame($column, $column->setDigits(12));
self::assertEquals(12, $column->getDigits());
Expand All @@ -30,7 +33,10 @@ public function testSetDigits(): void
*/
public function testGetDigits(): void
{
$column = $this->getMockBuilder(AbstractPrecisionColumn::class)->setConstructorArgs(['foo', 10])->onlyMethods([])->getMock();
$column = $this->getMockBuilder(AbstractPrecisionColumn::class)
->setConstructorArgs(['foo', 10])
->onlyMethods([])
->getMock();
self::assertEquals(10, $column->getDigits());
}

Expand All @@ -39,7 +45,10 @@ public function testGetDigits(): void
*/
public function testSetDecimal(): void
{
$column = $this->getMockBuilder(AbstractPrecisionColumn::class)->setConstructorArgs(['foo', 10, 5])->onlyMethods([])->getMock();
$column = $this->getMockBuilder(AbstractPrecisionColumn::class)
->setConstructorArgs(['foo', 10, 5])
->onlyMethods([])
->getMock();
self::assertEquals(5, $column->getDecimal());
self::assertSame($column, $column->setDecimal(2));
self::assertEquals(2, $column->getDecimal());
Expand All @@ -50,7 +59,10 @@ public function testSetDecimal(): void
*/
public function testGetDecimal(): void
{
$column = $this->getMockBuilder(AbstractPrecisionColumn::class)->setConstructorArgs(['foo', 10, 5])->onlyMethods([])->getMock();
$column = $this->getMockBuilder(AbstractPrecisionColumn::class)
->setConstructorArgs(['foo', 10, 5])
->onlyMethods([])
->getMock();
self::assertEquals(5, $column->getDecimal());
}

Expand All @@ -59,7 +71,10 @@ public function testGetDecimal(): void
*/
public function testGetExpressionData(): void
{
$column = $this->getMockBuilder(AbstractPrecisionColumn::class)->setConstructorArgs(['foo', 10, 5])->onlyMethods([])->getMock();
$column = $this->getMockBuilder(AbstractPrecisionColumn::class)
->setConstructorArgs(['foo', 10, 5])
->onlyMethods([])
->getMock();

self::assertEquals(
[['%s %s NOT NULL', ['foo', 'INTEGER(10,5)'], [$column::TYPE_IDENTIFIER, $column::TYPE_LITERAL]]],
Expand Down
8 changes: 6 additions & 2 deletions test/unit/Sql/Platform/PlatformTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,12 @@ protected function resolveAdapter(string $platformName): Adapter
/** @var DriverInterface|MockObject $mockDriver */
$mockDriver = $this->getMockBuilder(DriverInterface::class)->getMock();

$mockDriver->expects($this->any())->method('formatParameterName')->willReturn('?');
$mockDriver->expects($this->any())->method('createStatement')->willReturnCallback(fn() => new StatementContainer());
$mockDriver->expects($this->any())
->method('formatParameterName')
->willReturn('?');
$mockDriver->expects($this->any())
->method('createStatement')
->willReturnCallback(fn() => new StatementContainer());

return new Adapter($mockDriver, $platform);
}
Expand Down
Loading