public function testEnvelopesCanBeRemovedFromCollectionUsingUnset()
 {
     $collection = new EventEnvelopeCollection();
     $first_event = $this->getTestEvent('Unit-Test-3');
     $second_event = $this->getTestEvent('Unit-Test-2');
     $first_envelope = new EventEnvelope($first_event, []);
     $second_envelope = new EventEnvelope($second_event, []);
     $collection[] = $first_envelope;
     $collection["2"] = $second_envelope;
     unset($collection[0]);
     unset($collection["2"]);
     /** @var EventEnvelopeCollection $collection */
     $this->assertTrue($collection->isEmpty());
     $this->assertCount(0, $collection);
     $this->assertFalse(isset($collection[0]));
     $this->assertFalse(isset($collection["2"]));
     $this->assertNull($collection[0]);
     $this->assertNull($collection["2"]);
 }
Example #2
0
 /**
  * @return bool
  */
 public final function hasChanges()
 {
     return !$this->trackedChanges->isEmpty();
 }