54 $oldFactory->register(
'foo',
'GlobalVarConfig::newInstance' );
55 $oldFactory->register(
'bar',
'GlobalVarConfig::newInstance' );
56 $oldFactory->register(
'quux',
'GlobalVarConfig::newInstance' );
59 $foo = $oldFactory->makeConfig(
'foo' );
60 $bar = $oldFactory->makeConfig(
'bar' );
61 $quux = $oldFactory->makeConfig(
'quux' );
65 $newFactory->register(
'foo',
'GlobalVarConfig::newInstance' );
66 $newFactory->register(
'bar',
function () {
72 $newFactory->salvage( $oldFactory );
74 $newFoo = $newFactory->makeConfig(
'foo' );
75 $this->assertSame( $foo, $newFoo,
'existing instance should be salvaged' );
77 $newBar = $newFactory->makeConfig(
'bar' );
78 $this->assertNotSame( $bar, $newBar,
'don\'t salvage if callbacks differ' );
81 $this->setExpectedException(
'ConfigException' );
82 $newFactory->makeConfig(
'quux' );