Ejemplo n.º 1
0
 public function testGetAllReviews()
 {
     $myDb = DBMaker::create('ptest');
     Database::clearDB();
     $db = Database::getDB('ptest', 'C:\\xampp\\myConfig.ini');
     $reviews = ReviewsDB::getAllReviews();
     $this->assertEquals(6, count($reviews), 'It should fetch all of the reviews in the test database');
     foreach ($reviews as $review) {
         $this->assertTrue(is_a($review, 'Review'), 'It should return valid Review objects');
     }
 }
Ejemplo n.º 2
0
<?php 
include_once "../models/Database.class.php";
include_once "../models/Messages.class.php";
include_once "../models/Review.class.php";
include_once "../models/ReviewsDB.class.php";
include_once "../models/Submission.class.php";
include_once "../models/SubmissionsDB.class.php";
include_once "../models/User.class.php";
include_once "../models/UsersDB.class.php";
include_once "./makeDB.php";
?>


<h2>It should get all reviews from a test database</h2>
<?php 
makeDB('ptest');
Database::clearDB();
$db = Database::getDB('ptest');
$reviews = ReviewsDB::getAllReviews();
$reviewCount = count($reviews);
echo "Number of reviews in db is: {$reviewCount} <br>";
foreach ($reviews as $review) {
    echo "{$review} <br>";
}
?>
	


</body>
</html>