This repository has been archived by the owner on Jan 8, 2020. It is now read-only.
/
PgsqlTest.php
147 lines (131 loc) · 4.77 KB
/
PgsqlTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<?php
namespace ZendTest\Db\Adapter\Driver\Pgsql;
use Zend\Db\Adapter\Driver\Pgsql\Pgsql;
class PgsqlTest extends \PHPUnit_Framework_TestCase
{
/**
* @var Pgsql
*/
protected $pgsql = null;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
{
$this->pgsql = new Pgsql(array());
}
/**
* @covers Zend\Db\Adapter\Driver\Pgsql\Pgsql::checkEnvironment
*/
public function testCheckEnvironment()
{
if (extension_loaded('pgsql')) {
$this->markTestSkipped('PostgreSQL extension (pgsql) is already loaded');
}
$this->setExpectedException('Zend\Db\Adapter\Exception\RuntimeException');
$this->pgsql->checkEnvironment();
}
/**
* @covers Zend\Db\Adapter\Driver\Pgsql\Pgsql::registerConnection
*/
public function testRegisterConnection()
{
$mockConnection = $this->getMockForAbstractClass('Zend\Db\Adapter\Driver\Pgsql\Connection', array(array()), '', true, true, true, array('setDriver'));
$mockConnection->expects($this->once())->method('setDriver')->with($this->equalTo($this->pgsql));
$this->assertSame($this->pgsql, $this->pgsql->registerConnection($mockConnection));
}
/**
* @covers Zend\Db\Adapter\Driver\Pgsql\Pgsql::registerStatementPrototype
*/
public function testRegisterStatementPrototype()
{
$this->pgsql = new Pgsql(array());
$mockStatement = $this->getMockForAbstractClass('Zend\Db\Adapter\Driver\Pgsql\Statement', array(), '', true, true, true, array('setDriver'));
$mockStatement->expects($this->once())->method('setDriver')->with($this->equalTo($this->pgsql));
$this->assertSame($this->pgsql, $this->pgsql->registerStatementPrototype($mockStatement));
}
/**
* @covers Zend\Db\Adapter\Driver\Pgsql\Pgsql::registerResultPrototype
*/
public function testRegisterResultPrototype()
{
$this->pgsql = new Pgsql(array());
$mockStatement = $this->getMockForAbstractClass('Zend\Db\Adapter\Driver\Pgsql\Result', array(), '', true, true, true, array('setDriver'));
$this->assertSame($this->pgsql, $this->pgsql->registerResultPrototype($mockStatement));
}
/**
* @covers Zend\Db\Adapter\Driver\Pgsql\Pgsql::getDatabasePlatformName
*/
public function testGetDatabasePlatformName()
{
$this->pgsql = new Pgsql(array());
$this->assertEquals('Postgresql', $this->pgsql->getDatabasePlatformName());
$this->assertEquals('PostgreSQL', $this->pgsql->getDatabasePlatformName(Pgsql::NAME_FORMAT_NATURAL));
}
/**
* @depends testRegisterConnection
* @covers Zend\Db\Adapter\Driver\Pgsql\Pgsql::getConnection
*/
public function testGetConnection($mockConnection)
{
$conn = new \Zend\Db\Adapter\Driver\Pgsql\Connection(array());
$this->pgsql->registerConnection($conn);
$this->assertSame($conn, $this->pgsql->getConnection());
}
/**
* @covers Zend\Db\Adapter\Driver\Pgsql\Pgsql::createStatement
* @todo Implement testGetPrepareType().
*/
public function testCreateStatement()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers Zend\Db\Adapter\Driver\Pgsql\Pgsql::createResult
* @todo Implement testGetPrepareType().
*/
public function testCreateResult()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers Zend\Db\Adapter\Driver\Pgsql\Pgsql::getPrepareType
* @todo Implement testGetPrepareType().
*/
public function testGetPrepareType()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers Zend\Db\Adapter\Driver\Pgsql\Pgsql::formatParameterName
* @todo Implement testFormatParameterName().
*/
public function testFormatParameterName()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers Zend\Db\Adapter\Driver\Pgsql\Pgsql::getLastGeneratedValue
* @todo Implement testGetLastGeneratedValue().
*/
public function testGetLastGeneratedValue()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
}