Loads the default configuration if it's not present a custom one.
public loadConfiguration ( ) : array | ||
Résultat | array |
public function testAdditionalConfValues() { $testAdditional = array('test' => 1); $this->default = array_merge($this->default, $testAdditional); FakerinoConf::loadConfiguration($testAdditional); $this->assertEquals(array_keys($this->default), array_keys(FakerinoConf::toArray())); }
public function testHandlerWithConfiguration() { $fakeConf['fake'] = array('fakeTest' => array('Unknown', 'Surname' => null)); FakerinoConf::loadConfiguration($fakeConf); $firstHandler = new CustomFakerClass(); $handler = new ConfFakerClass(); $firstHandler->setSuccessor($handler); $this->assertInstanceOf('Fakerino\\Core\\FakeHandler\\Handler', $firstHandler); $this->assertInternalType('array', $firstHandler->handle(new FakeElement('fakeTest'))); }
public function setUp() { $this->conf['fake'] = array('fake1' => array('Name' => array('length' => 3), 'Surname' => null), 'fake2' => array('Name' => array('length' => 30), 'Surname' => null), 'fake3' => array('fake1', 'fake2')); FakerinoConf::loadConfiguration($this->conf); $fakeHandler = new FakeHandler\FakeHandler(); $fakeHandler->setSuccessor(new FakeHandler\FileFakerClass()); $fakeHandler->setSuccessor(new FakeHandler\CustomFakerClass()); $fakeHandler->setSuccessor(new FakeHandler\ConfFakerClass()); $fakeHandler->setSuccessor(new FakeHandler\DefaultFakerClass()); $this->fakeGenerator = new FakeDataFactory($fakeHandler, new DoctrineLayer(), new TwigTemplate()); }
public function testHandler() { $elementToFake = 'Surname'; $fakerinoDefaultConf = new FakerinoConf(); $fakerinoDefaultConf->loadConfiguration(); $fileFakePath = $this->getFileFakePath($fakerinoDefaultConf); $fakeFile = $fileFakePath . strtolower($elementToFake) . '.txt'; $handler = new FileFakerClass($fileFakePath); $customClass = new FakeElement($elementToFake); $fileContent = $this->getFileContent($fakeFile); $result = $handler->handle($customClass); $isResultValueExistsInFile = in_array($result, $fileContent); $this->assertInstanceOf('Fakerino\\Core\\FakeHandler\\Handler', $handler); $this->assertInternalType('string', $result); $this->assertTrue($isResultValueExistsInFile); }
public function setUp() { FakerinoConf::loadConfiguration(); $this->FileFakeGenerator = new FileFakeGenerator(); $this->FileFakeGenerator->setCaller(new Text()); }