/**
  * Parse a MergeRequestCollection from an array
  * @param array $data
  * @return MergeRequestCollection|MergeRequest[]
  */
 public static function fromArray(array $data)
 {
     $collection = new self();
     foreach ($data as $mergeRequestData) {
         $collection[] = Comment::fromArray($mergeRequestData);
     }
     return $collection;
 }
Exemple #2
0
 public function testFromArray()
 {
     $actual = Comment::fromArray(['author' => ['id' => 1, 'username' => 'admin', 'email' => '*****@*****.**', 'name' => 'Administrator', 'blocked' => false, 'created_at' => '2012-04-29T08=>46=>00Z'], 'note' => 'text1']);
     $this->assertEquals('text1', $actual->note);
     $this->assertInstanceOf(User::class, $actual->author);
 }