Beispiel #1
0
 public function testEqualsThrowsExceptionIfBothObjectsAreIncomparable()
 {
     self::setExpectedException(IncomparableException::class);
     $objectA = new Author('first', 'last');
     $objectB = $this->getMockBuilder(Comparable::class)->getMockForAbstractClass();
     $objectA->equals($objectB);
 }
Beispiel #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']));
 }
 /**
  * @param Author $a
  * @param Author $b
  * @return boolean
  */
 private function equalsAuthors(Author $a, Author $b)
 {
     return $a->equals($b);
 }