public function testHelperInstances()
 {
     $chargify = new Chargify(array('hostname' => 'fdsfs', 'api_key' => 'fdsfds', 'shared_key' => 'fdsfds'));
     $adjustment = $chargify->adjustment();
     $this->assertInstanceOf('Crucial\\Service\\Chargify\\Adjustment', $adjustment);
     $charge = $chargify->charge();
     $this->assertInstanceOf('Crucial\\Service\\Chargify\\Charge', $charge);
     $component = $chargify->component();
     $this->assertInstanceOf('Crucial\\Service\\Chargify\\Component', $component);
     $coupon = $chargify->coupon();
     $this->assertInstanceOf('Crucial\\Service\\Chargify\\Coupon', $coupon);
     $customer = $chargify->customer();
     $this->assertInstanceOf('Crucial\\Service\\Chargify\\Customer', $customer);
     $event = $chargify->event();
     $this->assertInstanceOf('Crucial\\Service\\Chargify\\Event', $event);
     $product = $chargify->product();
     $this->assertInstanceOf('Crucial\\Service\\Chargify\\Product', $product);
     $refund = $chargify->refund();
     $this->assertInstanceOf('Crucial\\Service\\Chargify\\Refund', $refund);
     $statement = $chargify->statement();
     $this->assertInstanceOf('Crucial\\Service\\Chargify\\Statement', $statement);
     $stats = $chargify->stats();
     $this->assertInstanceOf('Crucial\\Service\\Chargify\\Stats', $stats);
     $subscription = $chargify->subscription();
     $this->assertInstanceOf('Crucial\\Service\\Chargify\\Subscription', $subscription);
     $transaction = $chargify->transaction();
     $this->assertInstanceOf('Crucial\\Service\\Chargify\\Transaction', $transaction);
     $webhook = $chargify->webhook();
     $this->assertInstanceOf('Crucial\\Service\\Chargify\\Webhook', $webhook);
 }
 /**
  * @todo assert http response code
  */
 public function testNoShippingCreatesError()
 {
     $chargify = new Chargify(array('hostname' => 'sdfdsf', 'api_key' => 'fsdfdsf', 'shared_key' => 'fsdfdsf'));
     // set a mock response on the client
     $mock = new Mock([MockResponse::read('subscription.error.no_shipping')]);
     $chargify->getHttpClient()->getEmitter()->attach($mock);
     $subscription = $chargify->subscription()->setProductId(123)->setCustomerAttributes(array('first_name' => 'Darryl', 'last_name' => 'Strawberry', 'email' => '*****@*****.**', 'organization' => 'Mets'))->setPaymentProfileAttributes(array('first_name' => 'Darryl2', 'last_name' => 'Strawberry2', 'full_number' => '1', 'expiration_month' => '03', 'expiration_year' => '16', 'cvv' => '123', 'billing_address' => '600 N', 'billing_city' => 'Chicago', 'billing_state' => 'IL', 'billing_zip' => '60610', 'billing_country' => 'US'))->create();
     // $subscription object should be in an error state
     $this->assertTrue($subscription->isError());
     // get errors from $subscription
     $errors = $subscription->getErrors();
     // check for
     $this->assertContains('Shipping Address: cannot be blank.', $errors);
 }