public function testJsonEncode()
 {
     // We can only JSON encode our objects in PHP 5.4+. 5.3 must use ->__toJSON()
     if (version_compare(phpversion(), '5.4.0', '<')) {
         return;
     }
     $s = new StripeObject();
     $s->foo = 'a';
     $this->assertEquals('{"foo":"a"}', json_encode($s->__toArray()));
 }
Exemplo n.º 2
0
 public function testReplaceNewNestedUpdatable()
 {
     StripeObject::init();
     // Populate the $nestedUpdatableAttributes Set
     $s = new StripeObject();
     $s->metadata = array('bar');
     $this->assertSame($s->metadata, array('bar'));
     $s->metadata = array('baz', 'qux');
     $this->assertSame($s->metadata, array('baz', 'qux'));
 }
 public static function init()
 {
     self::$permanentAttributes = new Util\Set(array('_opts', 'id'));
     self::$nestedUpdatableAttributes = new Util\Set(array('metadata', 'legal_entity', 'address', 'dob', 'transfer_schedule', 'verification', 'tos_acceptance', 'personal_address', 'additional_owners', 0, 1, 2, 3, 4));
 }