public function testCanParseToken()
 {
     $fogbugz = new FogBugz($this->user, $this->pass, $this->url);
     // swap out or connection object
     $fogbugz->curl = $this->getMock('FogBugzCurl');
     // set the xml we would expect to see on a login
     $fogbugz->curl->expects($this->any())->method('fetch')->will($this->returnValue(file_get_contents(__DIR__ . '/data/login_expected.xml')));
     // this will fetch the data above and parse the token
     $fogbugz->logon();
     $this->assertEquals('sdodkc5adoq244f1ef51d9dje1eu05', $fogbugz->token, "Unable to correctly parse token");
 }
 *   php sample.php --user username@example.com --pass password --url http://example.fogbugz.com
 *
 */
error_reporting(E_ALL | E_STRICT);
require_once __DIR__ . '/lib/api.php';
// collect the user and password from the command line
$options = (object) getopt('', array('user:'******'pass:'******'url:'));
if (empty($options->user) || empty($options->pass) || empty($options->url)) {
    exit("This script needs a user, password and url " . "set via --user [user] --pass [password] --url [url]\n");
}
// init our fogbugz api with the user and pass from the command line,
// and the url from the var above
$fogbugz = new FogBugz($options->user, $options->pass, $options->url);
// fogbugz will throw exceptions, so we catch them here
try {
    $fogbugz->logon();
    // You can call any FogBugz API method directly by using it's
    // name as a method name on the $fogbugz object.
    // It will turn the method name in to the command,
    // ?cmd={method_name} and it will add the array to the
    // get request automatically
    $xml = $fogbugz->listFilters();
    // this returns a SimpleXMLElement object, so
    // remember to treat it as such
    print "Fogbugz filter list for current user:\n";
    foreach ($xml->filters->children() as $filter) {
        print sprintf("[%s] %s\n", $filter['type'], (string) $filter);
    }
    // or perhaps and example with parameters,
    // note the array syntax there
    /*