Permalink
Browse files

Refactor: move ratings out of photo object

Created a new object ratings that covers the rating stuff.

This also partly fixes a problem introduced in one of the previous
commits that caused all categories to be visible for non-admin users.
  • Loading branch information...
jeroenrnl committed Jan 15, 2013
1 parent ba8ab2d commit 176c22acfcb9b357d60d0454ee20f86a1327416e
View
@@ -1645,7 +1645,6 @@
<field name="photographer_id">2</field>
<field name="location_id">3</field>
<field name="view" xsi:nil="true" />
- <field name="rating">7.50</field>
<field name="description" xsi:nil="true" />
<field name="date">2012-12-29</field>
<field name="time">12:50:59</field>
@@ -1680,7 +1679,6 @@
<field name="photographer_id">2</field>
<field name="location_id">4</field>
<field name="view" xsi:nil="true" />
- <field name="rating">4.25</field>
<field name="description" xsi:nil="true" />
<field name="date">2012-12-29</field>
<field name="time">12:50:59</field>
@@ -1715,7 +1713,6 @@
<field name="photographer_id">2</field>
<field name="location_id">4</field>
<field name="view" xsi:nil="true" />
- <field name="rating">5.00</field>
<field name="description" xsi:nil="true" />
<field name="date">2012-12-29</field>
<field name="time">12:50:59</field>
@@ -1750,7 +1747,6 @@
<field name="photographer_id">3</field>
<field name="location_id">5</field>
<field name="view" xsi:nil="true" />
- <field name="rating">6.50</field>
<field name="description" xsi:nil="true" />
<field name="date">2012-12-29</field>
<field name="time">12:50:59</field>
@@ -1785,7 +1781,6 @@
<field name="photographer_id">3</field>
<field name="location_id">5</field>
<field name="view" xsi:nil="true" />
- <field name="rating">9.50</field>
<field name="description" xsi:nil="true" />
<field name="date">2012-12-29</field>
<field name="time">12:50:59</field>
@@ -1820,7 +1815,6 @@
<field name="photographer_id">3</field>
<field name="location_id">6</field>
<field name="view" xsi:nil="true" />
- <field name="rating">6.00</field>
<field name="description" xsi:nil="true" />
<field name="date">2012-12-29</field>
<field name="time">12:51:00</field>
@@ -1855,7 +1849,6 @@
<field name="photographer_id">3</field>
<field name="location_id">7</field>
<field name="view" xsi:nil="true" />
- <field name="rating" xsi:nil="true" />
<field name="description" xsi:nil="true" />
<field name="date">2012-12-29</field>
<field name="time">12:51:00</field>
@@ -1890,7 +1883,6 @@
<field name="photographer_id">4</field>
<field name="location_id">10</field>
<field name="view" xsi:nil="true" />
- <field name="rating">6.00</field>
<field name="description" xsi:nil="true" />
<field name="date">2012-12-29</field>
<field name="time">12:51:00</field>
@@ -1925,7 +1917,6 @@
<field name="photographer_id">5</field>
<field name="location_id">13</field>
<field name="view" xsi:nil="true" />
- <field name="rating" xsi:nil="true" />
<field name="description" xsi:nil="true" />
<field name="date">2012-12-29</field>
<field name="time">12:51:00</field>
@@ -1960,7 +1951,6 @@
<field name="photographer_id">6</field>
<field name="location_id">14</field>
<field name="view" xsi:nil="true" />
- <field name="rating">5.50</field>
<field name="description" xsi:nil="true" />
<field name="date">2012-12-29</field>
<field name="time">12:51:00</field>
@@ -141,26 +141,6 @@ public function testAddComment($photo_id, $comment, $user_id) {
$this->assertEquals($obj->get_photo()->get("photo_id"), $photo->get("photo_id"));
}
- /**
- * Test adding ratings
- * @dataProvider getRatings
- */
- public function testAddRating($photo_id, $rating, $user_id, $avg) {
- global $_SERVER;
- global $user;
- $user = new user($user_id);
- $user->lookup();
-
- $photo=new photo($photo_id);
- $photo->lookup();
-
- $_SERVER["REMOTE_ADDR"]=$user->getName() . ".zoph.org";
- $photo->rate($user, $rating);
-
- $photo->lookup();
- $this->assertEquals($photo->get("rating"), $avg);
- }
-
public function getLocation() {
return array(
array(1, 5),
@@ -24,7 +24,8 @@
<file>importTest.php</file>
<file>personTest.php</file>
<file>photoTest.php</file>
- <file>placeTest.php</file>
+ <file>placeTest.php</file>
+ <file>ratingTest.php</file>
</testsuite>
</testsuites>
</phpunit>
Oops, something went wrong.

0 comments on commit 176c22a

Please sign in to comment.