Exemple #1
0
 /**
  * list the domains and ensure this new one was deleted
  * 
  * @depends testDeleteDomain
  */
 function testDomainWasDeleted()
 {
     // sleep for atleast one second between methods, it is only 'eventual consistency'
     sleep(1);
     $result = SimpleDB::listDomains();
     // look for the domain in the list
     $this->assertNotContains($this->test_domain, $result);
 }
Exemple #2
0
<?php

$debug = !empty($_GET['debug']);
define('DEBUG', $debug);
if ($debug) {
    header("Content-type: text/plain");
}
require_once 'utils.inc.php';
require_once 'SimpleDB.class.php';
$sdb = new SimpleDB('');
$r = $sdb->createDomain('UnitTest');
$list = $sdb->listDomains();
print_r($list);
Utils::printResult('CreateDomain', in_array('UnitTest', $list), $r);
$sdb->setDomain('UnitTest');
$a = array('name' => 'Bob', 'age' => 30);
$r = $sdb->putAttributesAssoc('bob', $a);
Utils::printResult('putAttributesAssoc', true, $r);
$r = $sdb->getAttributes('bob');
Utils::printResult('getAttributes', $r['name'] == 'Bob', $r);
$sdb->setSingleAttr('bob', 'foo', 'bar');
$r = $sdb->getAttributes('bob');
Utils::printResult('setSingleAttr', $r['foo'] == 'bar');
$a = array('alice' => array('name' => 'Alice', 'age' => 50), 'charlie' => array('name' => 'Charlie', 'age' => 20));
$r = $sdb->batchPutAttributesAssoc($a);
Utils::printResult('batchPutAttributesAssoc', true, $r);
$r = $sdb->query("SELECT * FROM UnitTest WHERE age>'25'");
Utils::printResult('query', count($r) == 2, $r);
$r = $sdb->singleAttrQuery('name', 'Alice');
Utils::printResult('singleAttrQuery - single val', count($r), $r);
$r = $sdb->singleAttrQuery('name', array('Alice', 'Bob'));