public function testPopulateFixture() { $label = new Label(); $label->populate($this->loadJsonFixture('fixture_label.json')); $this->assertEquals('enhancement', $label->getName()); $this->assertEquals('84b6eb', $label->getColor()); }
/** * @return Label[]|\ArrayObject */ public function getLabels() { if ($this->labels === null) { $labels = array_map(function ($data) { $label = new Label($this->client); $label->populate($data); return $label; }, $this->getAttribute('labels')); // use \ArrayObject instead of good old php arrays $this->labels = new \ArrayObject($labels); } return $this->labels; }