public function testLoad() { $options = array('class' => 'Cascade\\Tests\\Fixtures\\SampleClass', 'mandatory' => 'someValue', 'optional_X' => 'testing some stuff', 'optional_Y' => 'testing other stuff', 'hello' => 'hello', 'there' => 'there'); ClassLoader::$extraOptionHandlers = array('*' => array('hello' => function ($instance, $value) { $instance->setHello(strtoupper($value)); }), 'Cascade\\Tests\\Fixtures\\SampleClass' => array('there' => function ($instance, $value) { $instance->setThere(strtoupper($value) . '!!!'); })); $loader = new ClassLoader($options); $instance = $loader->load(); $expectedInstance = new SampleClass('someValue'); $expectedInstance->optionalX('testing some stuff'); $expectedInstance->optionalY = 'testing other stuff'; $expectedInstance->setHello('HELLO'); $expectedInstance->setThere('THERE!!!'); $this->assertEquals($expectedInstance, $instance); }