Example #1
0
 public function testProductCreateUpdateRead()
 {
     Stripe::setApiKey('sk_test_JieJALRz7rPz7boV17oMma7a');
     $ProductID = 'gold-' . self::generateRandomString(20);
     $p = Product::create(array('name' => 'Gold Product', 'id' => $ProductID, 'url' => 'www.stripe.com/gold'));
     $this->assertSame($p->url, 'www.stripe.com/gold');
     $p->name = 'A new Product name';
     $p->save();
     $this->assertSame($p->name, 'A new Product name');
     $this->assertSame($p->url, 'www.stripe.com/gold');
     $stripeProduct = Product::retrieve($ProductID);
     $this->assertSame($p->name, $stripeProduct->name);
     $this->assertSame($stripeProduct->url, 'www.stripe.com/gold');
 }