---
title: "PHPUnit & ConfigurationManager"
url: "https://www.typo3.net/d/105415-phpunit-configurationmanager"
source: "typo3.net"
tags: ["Extensions","Extbase","Frage"]
created: "2011-05-17"
last_reply: "2011-05-17"
replies: 0
solved: false
page: 1
pages: 1
lang: "de"
---

# PHPUnit & ConfigurationManager

Extensions › Extbase · 0 Antworten · gestartet 2011-05-17

## Eröffnungsbeitrag

**katja** · 2011-05-17 · [Beitrag #1](https://www.typo3.net/d/105415-phpunit-configurationmanager/1)

Hallo t3*,

ich habe versucht die ersten Tests zu schreiben und bin gleich auf einen bösen Fehler gestoßen:

Ich kann eine Instanz von CManager problemlos im Model erzeugen:

```php
public function __construct( $vars ){
	$configurationManager = t3lib_div::makeInstance('Tx_Extbase_Configuration_ConfigurationManager');
	$this->config = $configurationManager->getConfiguration('Settings', 'myext', 'pi1');
	$this->setVars( $vars );
	$this->setURL();
}
```

Wenn ich aber dieses Objekt innerhalb von einem Test aufrufe

```php
public function varsCanBeSet() {
	$vars = array( 'name'=>'katja' );
	$query = t3lib_div::makeInstance('TX_Myext_Domain_Model_QueryList', $vars);
	$this->assertEquals($vars, $query->getVars());	
}
```

bekomme ich "Fatal error:  Call to a member function getConfiguration() on a non-object in ../typo3_src-4.5.2/typo3/sysext/extbase/Classes/Configuration/ConfigurationManager.php on line 107"

Kann mir jemand vielleicht helfen??:'(

Nachtrag:
der Manager schaut so aus:

```php
object(Tx_Extbase_Configuration_ConfigurationManager)#50 (2) {
  ["objectManager:protected"]=>
  NULL
  ["concreteConfigurationManager:protected"]=>
  NULL
}
```

und GetConfiguration schaut so aus

```php
	public function getConfiguration($configurationType, $extensionName = NULL, $pluginName = NULL) {
		switch ($configurationType) {
			case self::CONFIGURATION_TYPE_SETTINGS :
				$configuration = $this->concreteConfigurationManager->getConfiguration($extensionName, $pluginName);
				return $configuration['settings'];
			case self::CONFIGURATION_TYPE_FRAMEWORK :
				return $this->concreteConfigurationManager->getConfiguration($extensionName, $pluginName);
			case self::CONFIGURATION_TYPE_FULL_TYPOSCRIPT :
				return $this->concreteConfigurationManager->getTypoScriptSetup();
			default :
				throw new Tx_Extbase_Configuration_Exception_InvalidConfigurationTypeException('Invalid configuration type "' . $configurationType . '"', 1206031879);
		}
	}
```

$this->concreteConfigurationManager ist NULL :( Warum?

Nachtrag2: Ich soll anscheinend eine 'FE'-Umgebung nachbauen

```php
	protected function initializeConcreteConfigurationManager() {
		if (TYPO3_MODE === 'FE') {
			$this->concreteConfigurationManager = $this->objectManager->get('Tx_Extbase_Configuration_FrontendConfigurationManager');
		} else {
			$this->concreteConfigurationManager = $this->objectManager->get('Tx_Extbase_Configuration_BackendConfigurationManager');
		}
	}
```

Danke & Grüße
Katja

---

Quelle: „PHPUnit & ConfigurationManager“, typo3.net, https://www.typo3.net/d/105415-phpunit-configurationmanager
Beiträge von Mitgliedern des Forums. Bitte mit Link auf die Diskussion zitieren.
