/** * Returns the scope of the specified object. * * @param string $objectName The object name * @return integer One of the Container::SCOPE_ constants * @throws \TYPO3\CMS\Extbase\Object\Container\Exception\UnknownObjectException * @api */ public function getScope($objectName) { if (!$this->isRegistered($objectName)) { throw new \TYPO3\CMS\Extbase\Object\Container\Exception\UnknownObjectException('Object "' . $objectName . '" is not registered.', 1265367590); } return $this->objectContainer->isSingleton($objectName) ? Container::SCOPE_SINGLETON : Container::SCOPE_PROTOTYPE; }
/** * @test */ public function isSingletonReturnsTrueForSingletonInstancesAndFalseForPrototypes() { $this->assertTrue($this->container->isSingleton('TYPO3\\CMS\\Extbase\\Object\\Container\\Container')); $this->assertFalse($this->container->isSingleton('TYPO3\\CMS\\Extbase\\Core\\Bootstrap')); }
/** * @test */ public function isSingletonReturnsTrueForSingletonInstancesAndFalseForPrototypes() { $this->assertTrue($this->container->isSingleton(\TYPO3\CMS\Extbase\Object\Container\Container::class)); $this->assertFalse($this->container->isSingleton(\TYPO3\CMS\Extbase\Core\Bootstrap::class)); }