This repository has been archived by the owner on Jan 8, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'ashawley-master' into develop
- Loading branch information
Showing
2 changed files
with
155 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
<?php | ||
/** | ||
* Zend Framework (http://framework.zend.com/) | ||
* | ||
* @link http://github.com/zendframework/zf2 for the canonical source repository | ||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
|
||
namespace ZendTest\Db\Metadata\Source; | ||
|
||
use Zend\Db\Adapter\Adapter; | ||
use Zend\Db\Metadata\Source\SqliteMetadata; | ||
|
||
/** | ||
* @requires extension sqlite | ||
*/ | ||
class SqliteMetadataTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
|
||
/** | ||
* @var SqliteMetadata | ||
*/ | ||
protected $metadata; | ||
|
||
/** | ||
* @var Adapter | ||
*/ | ||
protected $adapter; | ||
|
||
/** | ||
* Sets up the fixture, for example, opens a network connection. | ||
* This method is called before a test is executed. | ||
*/ | ||
protected function setUp() | ||
{ | ||
$this->adapter = new Adapter(array( | ||
'driver' => 'Pdo', | ||
'dsn' => 'sqlite::memory:' | ||
)); | ||
$this->metadata = new SqliteMetadata($this->adapter); | ||
|
||
} | ||
|
||
public function testGetSchemas() | ||
{ | ||
$schemas = $this->metadata->getSchemas(); | ||
$this->assertContains('main', $schemas); | ||
$this->assertCount(1, $schemas); | ||
} | ||
|
||
public function testGetTableNames() | ||
{ | ||
$tables = $this->metadata->getTableNames('main'); | ||
$this->assertCount(0, $tables); | ||
} | ||
|
||
public function testGetColumnNames() | ||
{ | ||
$columns = $this->metadata->getColumnNames(null, 'main'); | ||
$this->assertCount(0, $columns); | ||
} | ||
|
||
public function testGetConstraints() | ||
{ | ||
$constraints = $this->metadata->getConstraints(null, 'main'); | ||
$this->assertCount(0, $constraints); | ||
$this->assertContainsOnlyInstancesOf( | ||
'Zend\Db\Metadata\Object\ConstraintObject', | ||
$constraints | ||
); | ||
} | ||
|
||
/** | ||
* @group ZF2-3719 | ||
*/ | ||
public function testGetConstraintKeys() | ||
{ | ||
$keys = $this->metadata->getConstraintKeys( | ||
null, null, 'main' | ||
); | ||
$this->assertCount(0, $keys); | ||
$this->assertContainsOnlyInstancesOf( | ||
'Zend\Db\Metadata\Object\ConstraintKeyObject', | ||
$keys | ||
); | ||
} | ||
|
||
public function testGetTriggers() | ||
{ | ||
$triggers = $this->metadata->getTriggers('main'); | ||
$this->assertCount(0, $triggers); | ||
$this->assertContainsOnlyInstancesOf( | ||
'Zend\Db\Metadata\Object\TriggerObject', | ||
$triggers | ||
); | ||
} | ||
} |