Пример #1
0
<?php

require 'donations.php';
//create the new object
$testDonation = new donations();
echo "1. Donation Object Creation: ";
if ($testDonation != null) {
    echo "Passed.<br>\n";
} else {
    echo "Failed.<br>\n";
}
//make sure the database is clear
$testDonation->clearIt();
//add a new entry to the database
$testDonation->sqlInsert("AAA", "AAA", "AAA", "AAA", "AAA", 3, 0);
//test to find entries with ISNEW value 1, should return null
echo "2. Database contains 0 entries ISNEW=1, query for rows ISNEW=1 should return no entries: ";
$returnedRows = $testDonation->rowInfo(1);
if (count($returnedRows) == 0) {
    echo "Passed.<br>\n";
} else {
    echo "Failed.<br>\n";
}
//test to find entries with ISNEW value 0, should return 1 entry
echo "3. Database contains 1 entries ISNEW=1, query for rows ISNEW=1 should return 1 entry: ";
$returnedRows = $testDonation->rowInfo(0);
if (count($returnedRows) == 1) {
    echo "Passed.<br>\n";
} else {
    echo "Failed.<br>\n";
}