didItWorkNonEmptyArray($out);
?>
</pre>

<h1>Testing Loading of an object by Id Using Query With Order By</h1><?php 
$out = Infusionsoft_DataService::queryWithOrderBy(new Infusionsoft_Contact(), array('Id' => $contact->Id), "FirstName", true);
?>
<pre><?php 
didItWorkNonEmptyArray($out);
?>
</pre>


<h1>Testing Delete</h1>
<?php 
$out = $contact->delete();
?>
<pre>
It Worked!
</pre>

<h1>Testing GetAppSetting</h1>
<pre>
<?php 
$out = Infusionsoft_DataService::getAppSetting('Product', 'trackcpu');
echo didItWorkNotEmpty($out);
?>
</pre>

<h1>Testing addCustomField</h1>
<pre>
<?php

include '../infusionsoft.php';
include 'object_editor_all_tables.php';
include '../tests/testUtils.php';
Infusionsoft_SdkEventManager::attach('loaded', "DataObject.Loaded");
Infusionsoft_SdkEventManager::attach('deleted', "DataObject.Deleted");
Infusionsoft_SdkEventManager::attach('saved', "DataObject.Saved");
Infusionsoft_SdkEventManager::attach('saved2', "DataObject.Saved");
$contact = new Infusionsoft_Contact();
$contact->FirstName = 'TEST';
$contact->save();
$contact2 = new Infusionsoft_Contact($contact->Id);
$contact2->delete();
function loaded($event)
{
    echo 'Loaded!<br/>';
}
function deleted(Infusionsoft_SdkEvent $event)
{
    echo 'Deleted!<br/>';
}
function saved(Infusionsoft_SdkEvent $event)
{
    echo 'Saved!<br/>';
}
function saved2(Infusionsoft_SdkEvent $event)
{
    echo 'Saved2!<br/>';
}