public function testEquals()
 {
     $list = new HashableObjectStorage();
     $this->assertTrue($list->equals($list), 'Empty list should be equal to itself');
     $newList = clone $list;
     $this->assertTrue($list->equals($newList), 'Empty list should be equal to a clone of itself');
     $newList->attach(new HashableObject(1));
     $this->assertFalse($list->equals($newList), 'Empty list should not be equal to a list with an element');
     $list->attach(new HashableObject(1));
     $this->assertTrue($list->equals($newList), 'Two lists with the same element should be equal');
 }
Example #2
0
 /**
  * @see SplObjectStorage::attach
  *
  * @param Reference $reference
  * @param mixed $data Unused in the ReferenceList class.
  */
 public function attach($reference, $data = null)
 {
     if (!$reference->isEmpty()) {
         parent::attach($reference, $data);
     }
 }