/** * Get the library registry for the host class. * * @return LibRegistry\LibRegistry */ public function libs() { if ($this->_libs === null) { $this->_libs = LibRegistry::getInstance(); } return $this->_libs; }
/** * Test the libs() method. * * @return void */ public function testLibs() { $this->assertSame(LibRegistry::getInstance(), $this->TraitedClass->libs(), 'The LibRegistry instance attached to our traited class should be the same as the global LibRegistry singleton.'); }
/** * Test that subclassing doesn't interfere with base class. * * @return void */ public function testSubclassing() { $myRegistry = MyOwnRegistry::getInstance(); $this->assertNotSame(LibRegistry::getInstance(), $myRegistry, 'Subclass should be a separate singleton instance from parent class.'); }