5 require_once __DIR__
."/../../../setup.inc";
9 use pq\Mapper\ObjectManager
;
13 class ObjectManagerTest
extends \PHPUnit_Framework_TestCase
22 protected $objectManager;
25 * Sets up the fixture, for example, opens a network connection.
26 * This method is called before a test is executed.
28 protected function setUp() {
29 $this->conn
= new Connection(PQ_TEST_DSN
);
30 $this->conn
->exec(PQ_TEST_SETUP_SQL
);
31 Table
::$defaultConnection = $this->conn
;
33 $mapping = TestModel
::mapAs($mapper);
34 $mapping->getGateway()->getQueryExecutor()->attach(new QueryLogger());
35 $this->objectManager
= new ObjectManager($mapping);
39 * Tears down the fixture, for example, closes a network connection.
40 * This method is called after a test is executed.
42 protected function tearDown() {
46 public function testBasic() {
47 $row = $this->objectManager
->getMap()->getGateway()->find(["id="=>1])->current();
48 $row_id = $this->objectManager
->rowId($row);
49 $this->assertFalse($this->objectManager
->hasObject($row_id));
50 $this->objectManager
->createObject($row);
51 $this->assertTrue($this->objectManager
->hasObject($row_id));
52 $this->objectManager
->reset();
53 $this->assertFalse($this->objectManager
->hasObject($row_id));
57 * @covers pq\Mapper\ObjectManager::rowId
58 * @todo Implement testRowId().
60 public function testRowId() {
61 // Remove the following lines when you implement this test.
62 $this->markTestIncomplete(
63 'This test has not been implemented yet.'
68 * @covers pq\Mapper\ObjectManager::objectId
69 * @todo Implement testObjectId().
71 public function testObjectId() {
72 // Remove the following lines when you implement this test.
73 $this->markTestIncomplete(
74 'This test has not been implemented yet.'
79 * @covers pq\Mapper\ObjectManager::extractRowId
80 * @todo Implement testExtractRowId().
82 public function testExtractRowId() {
83 // Remove the following lines when you implement this test.
84 $this->markTestIncomplete(
85 'This test has not been implemented yet.'
90 * @covers pq\Mapper\ObjectManager::serializeRowId
91 * @todo Implement testSerializeRowId().
93 public function testSerializeRowId() {
94 // Remove the following lines when you implement this test.
95 $this->markTestIncomplete(
96 'This test has not been implemented yet.'
101 * @covers pq\Mapper\ObjectManager::hasObject
102 * @todo Implement testHasObject().
104 public function testHasObject() {
105 // Remove the following lines when you implement this test.
106 $this->markTestIncomplete(
107 'This test has not been implemented yet.'
112 * @covers pq\Mapper\ObjectManager::createObject
113 * @todo Implement testCreateObject().
115 public function testCreateObject() {
116 // Remove the following lines when you implement this test.
117 $this->markTestIncomplete(
118 'This test has not been implemented yet.'
123 * @covers pq\Mapper\ObjectManager::resetObject
124 * @todo Implement testResetObject().
126 public function testResetObject() {
127 // Remove the following lines when you implement this test.
128 $this->markTestIncomplete(
129 'This test has not been implemented yet.'
134 * @covers pq\Mapper\ObjectManager::getObject
135 * @todo Implement testGetObject().
137 public function testGetObject() {
138 // Remove the following lines when you implement this test.
139 $this->markTestIncomplete(
140 'This test has not been implemented yet.'
145 * @covers pq\Mapper\ObjectManager::getObjectById
146 * @todo Implement testGetObjectById().
148 public function testGetObjectById() {
149 // Remove the following lines when you implement this test.
150 $this->markTestIncomplete(
151 'This test has not been implemented yet.'
156 * @covers pq\Mapper\ObjectManager::asObject
157 * @todo Implement testAsObject().
159 public function testAsObject() {
160 // Remove the following lines when you implement this test.
161 $this->markTestIncomplete(
162 'This test has not been implemented yet.'
167 * @covers pq\Mapper\ObjectManager::hasRow
168 * @todo Implement testHasRow().
170 public function testHasRow() {
171 // Remove the following lines when you implement this test.
172 $this->markTestIncomplete(
173 'This test has not been implemented yet.'
178 * @covers pq\Mapper\ObjectManager::createRow
179 * @todo Implement testCreateRow().
181 public function testCreateRow() {
182 // Remove the following lines when you implement this test.
183 $this->markTestIncomplete(
184 'This test has not been implemented yet.'
189 * @covers pq\Mapper\ObjectManager::resetRow
190 * @todo Implement testResetRow().
192 public function testResetRow() {
193 // Remove the following lines when you implement this test.
194 $this->markTestIncomplete(
195 'This test has not been implemented yet.'
200 * @covers pq\Mapper\ObjectManager::getRow
201 * @todo Implement testGetRow().
203 public function testGetRow() {
204 // Remove the following lines when you implement this test.
205 $this->markTestIncomplete(
206 'This test has not been implemented yet.'
211 * @covers pq\Mapper\ObjectManager::asRow
212 * @todo Implement testAsRow().
214 public function testAsRow() {
215 // Remove the following lines when you implement this test.
216 $this->markTestIncomplete(
217 'This test has not been implemented yet.'