public function testOffsetStores() { $obs = $this->getNewObserver(); $rprop = new ReflectionProperty($this->cut, '_storage'); $rprop->setAccessible(true); $this->assertFalse($this->obj->contains($obs)); $this->obj[$obs] = 69; $this->assertTrue($this->obj->contains($obs)); }
/** * @depends testCanInstantiateWithoutArgument * @depends testHasInternalStorage */ public function testDetachRemovesObserverInStorage($l) { $mockObserver = $this->getMockSplObserver(); $splstorage = new Cpanel_Core_PriorityQueue(); $splstorage->attach($mockObserver, 'fake'); $rprop = new ReflectionProperty($this->cut, 'observers'); $rprop->setAccessible(true); $rprop->setValue($l, $splstorage); $countBefore = count($splstorage); $l->detach($mockObserver); $countAfter = count($rprop->getValue($l)); $this->assertLessThan($countBefore, $countAfter); }