public function testNestedRelationships() { $model = new Relax_Client_Model($this->connection); $model->hasMany($model->define('Transaction')->hasMany('PaymentDevice')->hasMany('PaymentIntention')->hasMany('TransactionItem', 'items', 'item'))->hasMany($model->define('Customer')->hasOne('Address')); $items = $model->transactions(1)->items(); $address = $model->customers(1)->address(); $this->assertInstanceOf('Relax_Client_Resource', $address); $this->assertInstanceOf('Relax_Client_Collection', $items); $this->assertEquals($address->url(), 'customers/1/address'); $this->assertEquals($items->url(), 'transactions/1/items'); }