Changeset 997
- Timestamp:
- 10/28/07 13:25:51 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/main/php/net/stubbles/rdbms/persistence/serializer/stubDatabaseSerializer.php
r951 r997 35 35 */ 36 36 protected $connection; 37 /** 38 * data has been inserted 39 */ 40 const INSERT = 'insert'; 41 /** 42 * data has been updated 43 */ 44 const UPDATE = 'update'; 37 45 38 46 /** … … 80 88 * 81 89 * @param stubObject $entity 90 * @return string 82 91 * @throws stubDatabaseSerializerException 83 92 * @throws stubPersistenceException … … 144 153 throw new stubDatabaseSerializerException('Can not persist ' . $entityClass->getFullQualifiedClassName() . ': a database error occured.', $dbe); 145 154 } 155 156 return (($tableRow->hasCriterion() === true) ? (self::UPDATE) : (self::INSERT)); 146 157 } 147 158 trunk/src/test/php/net/stubbles/rdbms/persistence/serializer/stubDatabaseSerializerTestCase.php
r951 r997 124 124 $this->mockConnection->expectCallcount('exec', 1); 125 125 $this->mockQueryBuilder->setInsertQueries(array('foo' => 'foo')); 126 $this-> dbSerializer->serialize($singlePrimaryKeyEntity);126 $this->assertEqual($this->dbSerializer->serialize($singlePrimaryKeyEntity), stubDatabaseSerializer::INSERT); 127 127 $this->assertEqual($this->mockQueryBuilder->getCallCount('createInsert'), 1); 128 128 $this->assertEqual($this->mockQueryBuilder->getCallCount('createUpdate'), 0); … … 146 146 $this->mockConnection->expectCallcount('exec', 1); 147 147 $this->mockQueryBuilder->setUpdateQueries(array('foo' => 'foo')); 148 $this-> dbSerializer->serialize($singlePrimaryKeyEntity);148 $this->assertEqual($this->dbSerializer->serialize($singlePrimaryKeyEntity), stubDatabaseSerializer::UPDATE); 149 149 $this->assertEqual($this->mockQueryBuilder->getCallCount('createInsert'), 0); 150 150 $this->assertEqual($this->mockQueryBuilder->getCallCount('createUpdate'), 1);
