-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12262 from Jurigag/3.0.x-describe-references
Fix describeReferences
- Loading branch information
Showing
8 changed files
with
106 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
|
||
namespace Phalcon\Test\Unit\Db\Adapter\Pdo; | ||
|
||
use Phalcon\Db\Reference; | ||
use Phalcon\Test\Module\UnitTest; | ||
use Phalcon\Db\Adapter\Pdo\Mysql; | ||
|
||
|
@@ -87,4 +88,24 @@ function () { | |
} | ||
); | ||
} | ||
|
||
/** | ||
* Tests Mysql::describeReferences | ||
* | ||
* @author Wojciechj Ślawski <[email protected]> | ||
* @since 2016-09-28 | ||
*/ | ||
public function testDescribeReferencesColumnsCount() | ||
{ | ||
$this->specify( | ||
'Mysql::describeReferences return wrong number of columns in Phalcon\Db\Reference', | ||
function() { | ||
$references = $this->connection->describeReferences("robots_parts", TEST_DB_MYSQL_NAME); | ||
/** @var Reference $reference */ | ||
foreach($references as $reference) { | ||
expect($reference->getColumns())->count(1); | ||
} | ||
} | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<?php | ||
|
||
namespace Phalcon\Test\Unit\Db\Adapter\Pdo; | ||
|
||
use Phalcon\Db\Adapter\Pdo\Postgresql; | ||
use Phalcon\Db\Reference; | ||
use Phalcon\Test\Module\UnitTest; | ||
|
||
/** | ||
* \Phalcon\Test\Unit\Db\Adapter\Pdo\Postgresql | ||
* Tests the \Phalcon\Db\Adapter\Pdo\Postgresql component | ||
* | ||
* @copyright (c) 2011-2016 Phalcon Team | ||
* @link http://www.phalconphp.com | ||
* @author Andres Gutierrez <[email protected]> | ||
* @author Serghei Iakovlev <[email protected]> | ||
* @author Wojciech Ślawski <[email protected]> | ||
* @package Phalcon\Test\Unit\Db\Adapter\Pdo | ||
* | ||
* The contents of this file are subject to the New BSD License that is | ||
* bundled with this package in the file docs/LICENSE.txt | ||
* | ||
* If you did not receive a copy of the license and are unable to obtain it | ||
* through the world-wide-web, please send an email to [email protected] | ||
* so that we can send you a copy immediately. | ||
*/ | ||
class PostgresqlTest extends UnitTest | ||
{ | ||
/** | ||
* @var Postgresql | ||
*/ | ||
protected $connection; | ||
|
||
public function _before() | ||
{ | ||
parent::_before(); | ||
|
||
$this->connection = new Postgresql([ | ||
'host' => TEST_DB_POSTGRESQL_HOST, | ||
'username' => TEST_DB_POSTGRESQL_USER, | ||
'password' => TEST_DB_POSTGRESQL_PASSWD, | ||
'dbname' => TEST_DB_POSTGRESQL_NAME, | ||
'port' => TEST_DB_POSTGRESQL_PORT, | ||
'schema' => TEST_DB_POSTGRESQL_SCHEMA | ||
]); | ||
} | ||
|
||
/** | ||
* Tests Postgresql::describeReferences | ||
* | ||
* @author Wojciech Ślawski <[email protected]> | ||
* @since 2016-09-28 | ||
*/ | ||
public function testDescribeReferencesColumnsCount() | ||
{ | ||
$this->specify( | ||
'Postgresql::describeReferences return wrong number of columns in Phalcon\Db\Reference', | ||
function() { | ||
$references = $this->connection->describeReferences("robots_parts", TEST_DB_POSTGRESQL_NAME); | ||
/** @var Reference $reference */ | ||
foreach($references as $reference) { | ||
expect($reference->getColumns())->count(1); | ||
} | ||
} | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters