/** * Read a file * * @param string $path * * @return File */ public function fetchFile($path) { $document = $this->client->getDoc('stack:/' . $path); // create module via factory $module = $this->moduleFactory->createModule($document->module, $document->data); return new File($document, $module); }
public function testCustomModule() { $factory = new ModuleFactory(); $factory->addMappings(['mock' => '\\stack\\test\\ModuleFactoryTest_MockModule']); $module = $factory->createModule('mock', new \stdClass()); $this->assertInstanceOf('stack\\test\\ModuleFactoryTest_MockModule', $module); }