52 $oldFactory->register(
'foo',
'GlobalVarConfig::newInstance' );
53 $oldFactory->register(
'bar',
'GlobalVarConfig::newInstance' );
54 $oldFactory->register(
'quux',
'GlobalVarConfig::newInstance' );
57 $foo = $oldFactory->makeConfig(
'foo' );
58 $bar = $oldFactory->makeConfig(
'bar' );
59 $quux = $oldFactory->makeConfig(
'quux' );
63 $newFactory->register(
'foo',
'GlobalVarConfig::newInstance' );
64 $newFactory->register(
'bar',
function() {
70 $newFactory->salvage( $oldFactory );
72 $newFoo = $newFactory->makeConfig(
'foo' );
73 $this->assertSame( $foo, $newFoo,
'existing instance should be salvaged' );
75 $newBar = $newFactory->makeConfig(
'bar' );
76 $this->assertNotSame( $bar, $newBar,
'don\'t salvage if callbacks differ' );
79 $this->setExpectedException(
'ConfigException' );
80 $newFactory->makeConfig(
'quux' );