Skip to content

Commit

Permalink
Merge branch 'master' into 3.next
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed Oct 21, 2018
2 parents 79be31b + 6fa82ae commit bb655b1
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 8 deletions.
4 changes: 2 additions & 2 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ parameters:
- '#Variable \$_SESSION in isset\(\) always exists and is not nullable#'
- '#PHPDoc tag @throws with type PHPUnit\\Exception is not subtype of Throwable#'
- '#Call to an undefined method PHPUnit\\Framework\\MockObject\\MockObject#'
- '#Method Redis::setex\(\) invoked with 3 parameters, 0 required#'
- '#Method Redis::setnx\(\) invoked with 2 parameters, 0 required#'
- '#Binary operation "\+" between array|false and array results in an error#'
- '#Result of method Cake\\Auth\\BaseAuthenticate::unauthenticated\(\) \(void\) is used#'
earlyTerminatingMethodCalls:
Cake\Console\Shell:
- abort
Expand Down
6 changes: 0 additions & 6 deletions src/Console/ConsoleIo.php
Original file line number Diff line number Diff line change
Expand Up @@ -540,12 +540,6 @@ public function helper($name, array $settings = [])
*/
public function createFile($path, $contents, $forceOverwrite = false)
{
$path = str_replace(
DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR,
DIRECTORY_SEPARATOR,
$path
);

$this->out();
$forceOverwrite = $forceOverwrite || $this->forceOverwrite;

Expand Down
34 changes: 34 additions & 0 deletions tests/TestCase/Database/Schema/PostgresSchemaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,40 @@ public function testDescribeTableIndexesNullsFirst()
$connection->execute('DROP TABLE schema_index');
}

/**
* Test describing a table with postgres function defaults
*
* @return void
*/
public function testDescribeTableFunctionDefaultValue()
{
$this->_needsConnection();
$connection = ConnectionManager::get('test');
$sql = <<<SQL
CREATE TABLE schema_function_defaults (
"id" SERIAL,
year INT DEFAULT DATE_PART('year'::text, NOW()),
PRIMARY KEY("id")
);
SQL;
$connection->execute($sql);
$schema = new SchemaCollection($connection);
$result = $schema->describe('schema_function_defaults');
$connection->execute('DROP TABLE schema_function_defaults');

$expected = [
'type' => 'integer',
'default' => "date_part('year'::text, now())",
'null' => true,
'precision' => null,
'length' => 10,
'comment' => null,
'unsigned' => null,
'autoIncrement' => null,
];
$this->assertEquals($expected, $result->getColumn('year'));
}

/**
* Column provider for creating column sql
*
Expand Down

0 comments on commit bb655b1

Please sign in to comment.