public function testAttributesAreMutable()
 {
     $hal = new HalCollection(array(), 'item/route');
     $attributes = array('count' => 1376, 'order' => 'desc');
     $hal->setAttributes($attributes);
     $this->assertEquals($attributes, $hal->attributes);
 }
 public function testRendersAttributeAsPartOfPaginatedCollectionResource()
 {
     $this->setUpHelpers();
     $attributes = array('count' => 100, 'type' => 'foo');
     $prototype = array('foo' => 'bar');
     $items = array();
     foreach (range(1, 100) as $id) {
         $item = $prototype;
         $item['id'] = $id;
         $items[] = $item;
     }
     $adapter = new ArrayAdapter($items);
     $paginator = new Paginator($adapter);
     $collection = new HalCollection($paginator);
     $collection->setPageSize(5);
     $collection->setPage(3);
     $collection->setAttributes($attributes);
     $collection->setCollectionRoute('resource');
     $collection->setResourceRoute('resource');
     $links = $collection->getLinks();
     $self = new Link('self');
     $self->setRoute('resource');
     $links->add($self);
     $model = new RestfulJsonModel(array('payload' => $collection));
     $test = $this->renderer->render($model);
     $test = json_decode($test);
     $this->assertInstanceof('stdClass', $test, var_export($test, 1));
     $this->assertObjectHasAttribute('count', $test, var_export($test, 1));
     $this->assertEquals(100, $test->count);
     $this->assertObjectHasAttribute('type', $test);
     $this->assertEquals('foo', $test->type);
 }