Skip to content

Commit

Permalink
[Tests] Added missing unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
willdurand committed Nov 10, 2011
1 parent a197124 commit e4cbdd6
Show file tree
Hide file tree
Showing 6 changed files with 1,675 additions and 17 deletions.
3 changes: 1 addition & 2 deletions phpunit.xml.dist
Expand Up @@ -14,8 +14,7 @@


<testsuites> <testsuites>
<testsuite name="Propel2 Test Suite"> <testsuite name="Propel2 Test Suite">
<directory>./tests/Propel/Tests/Generator/</directory> <directory>./tests/Propel/Tests/</directory>
<directory>./tests/Propel/Tests/Runtime/</directory>
</testsuite> </testsuite>
</testsuites> </testsuites>


Expand Down
26 changes: 11 additions & 15 deletions src/Propel/Runtime/Util/BasePeer.php
Expand Up @@ -82,23 +82,19 @@ class BasePeer
*/ */
const TYPE_NUM = 'num'; const TYPE_NUM = 'num';


static public function getFieldnames ($classname, $type = self::TYPE_PHPNAME) { static public function getFieldnames($classname, $type = self::TYPE_PHPNAME)

{
// TODO we should take care of including the peer class here $peerclass = $classname . 'Peer';

$callable = array($peerclass, 'getFieldnames');
$peerclass = 'Base' . $classname . 'Peer'; // TODO is this always true?
$callable = array($peerclass, 'getFieldnames');


return call_user_func($callable, $type); return call_user_func($callable, $type);
} }


static public function translateFieldname($classname, $fieldname, $fromType, $toType) { static public function translateFieldname($classname, $fieldname, $fromType, $toType)

{
// TODO we should take care of including the peer class here $peerclass = $classname . 'Peer';

$callable = array($peerclass, 'translateFieldname');
$peerclass = 'Base' . $classname . 'Peer'; // TODO is this always true? $args = array($fieldname, $fromType, $toType);
$callable = array($peerclass, 'translateFieldname');
$args = array($fieldname, $fromType, $toType);


return call_user_func_array($callable, $args); return call_user_func_array($callable, $args);
} }
Expand Down Expand Up @@ -187,15 +183,15 @@ public static function doDelete(Criteria $criteria, ConnectionInterface $con)
*/ */
public static function doDeleteAll($tableName, ConnectionInterface $con, $databaseName = null) public static function doDeleteAll($tableName, ConnectionInterface $con, $databaseName = null)
{ {

try { try {
$db = Propel::getDB($databaseName); $db = Propel::getDB($databaseName);
if ($db->useQuoteIdentifier()) { if ($db->useQuoteIdentifier()) {
$tableName = $db->quoteIdentifierTable($tableName); $tableName = $db->quoteIdentifierTable($tableName);
} }
$sql = "DELETE FROM " . $tableName; $sql = "DELETE FROM " . $tableName;
$stmt = $con->prepare($sql); $stmt = $con->prepare($sql);

$stmt->execute(); $stmt->execute();


return $stmt->rowCount(); return $stmt->rowCount();
Expand Down

0 comments on commit e4cbdd6

Please sign in to comment.