Пример #1
0
 public function testEqualsThrowsExceptionIfBothObjectsAreIncomparable()
 {
     self::setExpectedException(IncomparableException::class);
     $objectA = new Author('first', 'last');
     $objectB = $this->getMockBuilder(Comparable::class)->getMockForAbstractClass();
     $objectA->equals($objectB);
 }
Пример #2
0
 /**
  * @param array $data
  * @return Authors
  */
 public static function deserialize(array $data)
 {
     assert(array_key_exists('elements', $data));
     return new self(array_map(function (array $element) {
         return Author::deserialize($element);
     }, $data['elements']));
 }
Пример #3
0
 /**
  * @param Author $a
  * @param Author $b
  * @return boolean
  */
 private function equalsAuthors(Author $a, Author $b)
 {
     return $a->equals($b);
 }