Skip to content
This repository was archived by the owner on Sep 10, 2021. It is now read-only.

Commit 0198ff5

Browse files
committed
BUG: refs #0359. We must explicitly cast feed.ressource to a string for pgsql
1 parent 0ce2b2d commit 0198ff5

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

core/models/pdo/FeedModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function getFeedByResourceAndType($typeArray, $dao)
2929
$sql = $this->database->select()
3030
->setIntegrityCheck(false)
3131
->from(array('p' => 'feed'))
32-
->where('ressource = ?', $dao->getKey());
32+
->where('ressource = ?', (string)$dao->getKey());
3333

3434
$rowset = $this->database->fetchAll($sql);
3535
$feeds = array();

core/tests/models/base/FeedModelTest.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function testCreateFeed()
7070
$this->assertEquals(true, $feed->saved);
7171
$feed = $this->Feed->createFeed($usersFile [0], MIDAS_FEED_CREATE_ITEM, $itemFile[0]);
7272
$this->assertEquals(true, $feed->saved);
73-
$feed = $this->Feed->createFeed($usersFile [0], MIDAS_FEED_CREATE_USER, $usersFile [0]);
73+
$feed = $this->Feed->createFeed($usersFile [0], MIDAS_FEED_CREATE_USER, $usersFile[0]);
7474
$this->assertEquals(true, $feed->saved);
7575
$this->Feed->addCommunity($feed, $communityFile [0]);
7676
$communities = $feed->getCommunities();
@@ -79,4 +79,15 @@ public function testCreateFeed()
7979
$this->fail("Unable to add dao");
8080
}
8181
}
82+
83+
/** test Feed::getFeedByResourceAndType */
84+
public function testGetFeedByResourceAndType()
85+
{
86+
$usersFile = $this->loadData('User', 'default');
87+
$feed = $this->Feed->getFeedByResourceAndType(array(MIDAS_FEED_CREATE_USER), $usersFile[0]);
88+
$this->assertEquals(count($feed), 1);
89+
$this->assertEquals($feed[0]->user_id, $usersFile[0]->getKey());
90+
$this->assertEquals($feed[0]->type, MIDAS_FEED_CREATE_USER);
91+
$this->assertEquals($feed[0]->ressource, (string)$usersFile[0]->getKey());
92+
}
8293
}

0 commit comments

Comments
 (0)