Ejemplo n.º 1
0
 public function providerDump()
 {
     $config1 = new Config();
     $config1->setMaxTimestamp('2014-01-01T12:30:45+0100');
     $config1->setClassName('Entity\\User');
     $config1->setFakeNumber(10);
     $config1->setFormats(['php', 'json', 'xml', 'yaml', 'csv', 'sql', 'excel', 'perl', 'ruby', 'python']);
     $config1->setSeed(51);
     $config1->setLocale('fr_FR');
     $config1->setVariables([new Variable('firstname', 'firstName', [], false, false), new Variable('lastname', 'lastName', [], false, false), new Variable('birthday', 'dateTimeThisCentury', ['d/m/Y'], false, 0.5), new Variable('email', 'safeEmail', [], true, false)]);
     $config1->setColumns([new Column('person', null, null, [new Column('name', null, null, [new Column('firstname', '%firstname%', 'capitalize'), new Column('lastname', '%lastname%', 'capitalize')]), new Column('birthday', '%birthday%')]), new Column('email', '%email%')]);
     return [[$config1, true, 'all', ['zip' => 'fakery_User_\\d{4}-\\d{2}-\\d{2}_\\d{2}-\\d{2}-\\d{2}\\.zip'], ['fakery_User_\\d{4}-\\d{2}-\\d{2}_\\d{2}-\\d{2}-\\d{2}/Entity_User.csv', 'fakery_User_\\d{4}-\\d{2}-\\d{2}_\\d{2}-\\d{2}-\\d{2}/Entity_User.json', 'fakery_User_\\d{4}-\\d{2}-\\d{2}_\\d{2}-\\d{2}-\\d{2}/Entity_User.php', 'fakery_User_\\d{4}-\\d{2}-\\d{2}_\\d{2}-\\d{2}-\\d{2}/Entity_User.pl', 'fakery_User_\\d{4}-\\d{2}-\\d{2}_\\d{2}-\\d{2}-\\d{2}/Entity_User.py', 'fakery_User_\\d{4}-\\d{2}-\\d{2}_\\d{2}-\\d{2}-\\d{2}/Entity_User.rb', 'fakery_User_\\d{4}-\\d{2}-\\d{2}_\\d{2}-\\d{2}-\\d{2}/Entity_User.sql', 'fakery_User_\\d{4}-\\d{2}-\\d{2}_\\d{2}-\\d{2}-\\d{2}/Entity_User.xlsx', 'fakery_User_\\d{4}-\\d{2}-\\d{2}_\\d{2}-\\d{2}-\\d{2}/Entity_User.xml', 'fakery_User_\\d{4}-\\d{2}-\\d{2}_\\d{2}-\\d{2}-\\d{2}/Entity_User.yml', 'fakery_User_\\d{4}-\\d{2}-\\d{2}_\\d{2}-\\d{2}-\\d{2}/Entity_User_fakery_generator_config_\\d{4}-\\d{2}-\\d{2}_\\d{2}-\\d{2}-\\d{2}.json', 'fakery_User_\\d{4}-\\d{2}-\\d{2}_\\d{2}-\\d{2}-\\d{2}/Entity_User_fakery_generator_config_\\d{4}-\\d{2}-\\d{2}_\\d{2}-\\d{2}-\\d{2}.xml']]];
 }
 public function providerDump()
 {
     $config1 = new Config();
     $config1->setMaxTimestamp('2014-01-01T12:30:45+0100');
     $config1->setClassName('Entity\\User');
     $config1->setFakeNumber(10);
     $config1->setFormats(['php', 'json', 'xml', 'yaml', 'csv', 'sql', 'excel', 'perl', 'ruby', 'python']);
     $config1->setSeed(51);
     $config1->setLocale('fr_FR');
     $config1->setVariables([new Variable('firstname', 'firstName', [], false, false), new Variable('lastname', 'lastName', [], false, false), new Variable('birthday', 'dateTimeThisCentury', ['d/m/Y'], false, 0.5), new Variable('email', 'safeEmail', [], true, false)]);
     $config1->setColumns([new Column('person', null, null, [new Column('name', null, null, [new Column('firstname', '%firstname%', 'capitalize'), new Column('lastname', '%lastname%', 'capitalize')]), new Column('birthday', '%birthday%')]), new Column('email', '%email%')]);
     return [[$config1, true, 'all', "Dumping Configuration as JSON ...\nDumping Configuration as XML ...\nInitializing files ...\nFormats : php, json, xml, yaml, csv, sql, excel, perl, ruby, python\nGenerating 10 rows ...\n\r  1/10 [==>-------------------------]  10%\r  2/10 [=====>----------------------]  20%\r  3/10 [========>-------------------]  30%\r  4/10 [===========>----------------]  40%\r  5/10 [==============>-------------]  50%\r  6/10 [================>-----------]  60%\r  7/10 [===================>--------]  70%\r  8/10 [======================>-----]  80%\r  9/10 [=========================>--]  90%\r 10/10 [============================] 100%\nFinalizing files ...\n\r  1/10 [==>-------------------------]  10%\r  2/10 [=====>----------------------]  20%\r  3/10 [========>-------------------]  30%\r  4/10 [===========>----------------]  40%\r  5/10 [==============>-------------]  50%\r  6/10 [================>-----------]  60%\r  7/10 [===================>--------]  70%\r  8/10 [======================>-----]  80%\r  9/10 [=========================>--]  90%\r 10/10 [============================] 100%\nCompressing files into zip ...\n", ['zip' => 'fakery_User_\\d{4}-\\d{2}-\\d{2}_\\d{2}-\\d{2}-\\d{2}\\.zip'], ['fakery_User_\\d{4}-\\d{2}-\\d{2}_\\d{2}-\\d{2}-\\d{2}/Entity_User.csv', 'fakery_User_\\d{4}-\\d{2}-\\d{2}_\\d{2}-\\d{2}-\\d{2}/Entity_User.json', 'fakery_User_\\d{4}-\\d{2}-\\d{2}_\\d{2}-\\d{2}-\\d{2}/Entity_User.php', 'fakery_User_\\d{4}-\\d{2}-\\d{2}_\\d{2}-\\d{2}-\\d{2}/Entity_User.pl', 'fakery_User_\\d{4}-\\d{2}-\\d{2}_\\d{2}-\\d{2}-\\d{2}/Entity_User.py', 'fakery_User_\\d{4}-\\d{2}-\\d{2}_\\d{2}-\\d{2}-\\d{2}/Entity_User.rb', 'fakery_User_\\d{4}-\\d{2}-\\d{2}_\\d{2}-\\d{2}-\\d{2}/Entity_User.sql', 'fakery_User_\\d{4}-\\d{2}-\\d{2}_\\d{2}-\\d{2}-\\d{2}/Entity_User.xlsx', 'fakery_User_\\d{4}-\\d{2}-\\d{2}_\\d{2}-\\d{2}-\\d{2}/Entity_User.xml', 'fakery_User_\\d{4}-\\d{2}-\\d{2}_\\d{2}-\\d{2}-\\d{2}/Entity_User.yml', 'fakery_User_\\d{4}-\\d{2}-\\d{2}_\\d{2}-\\d{2}-\\d{2}/Entity_User_fakery_generator_config_\\d{4}-\\d{2}-\\d{2}_\\d{2}-\\d{2}-\\d{2}.json', 'fakery_User_\\d{4}-\\d{2}-\\d{2}_\\d{2}-\\d{2}-\\d{2}/Entity_User_fakery_generator_config_\\d{4}-\\d{2}-\\d{2}_\\d{2}-\\d{2}-\\d{2}.xml']]];
 }
Ejemplo n.º 3
0
 /**
  * @covers CSanquer\FakeryGenerator\Model\Config::getFormats
  * @covers CSanquer\FakeryGenerator\Model\Config::setFormats
  */
 public function testGetSetFormats()
 {
     $this->assertInstanceOf('\\CSanquer\\FakeryGenerator\\Model\\Config', $this->config->setFormats(['php', 'json']));
     $this->assertSame(['php', 'json'], $this->config->getFormats());
 }
 public function providerLoad()
 {
     $config1 = new Config();
     $config1->setMaxTimestamp('2014-01-01T12:30:45+0100');
     $config1->setClassName('Entity\\User');
     $config1->setFakeNumber(500);
     $config1->setFormats(['php', 'json', 'xml']);
     $config1->setSeed(51);
     $config1->setLocale('fr_FR');
     $config1->setVariables([new Variable('firstname', 'firstName', [], false, false), new Variable('lastname', 'lastName', [], false, false), new Variable('birthday', 'dateTimeThisCentury', ['d/m/Y'], false, 0.5), new Variable('email', 'safeEmail', [], true, false)]);
     $config1->setColumns([new Column('person', null, null, [new Column('name', null, null, [new Column('firstname', '%firstname%', 'capitalize'), new Column('lastname', '%lastname%', 'capitalize')]), new Column('birthday', '%birthday%')]), new Column('email', '%email%')]);
     return [['Entity_User_fakery_generator_config.json', $config1], ['Entity_User_fakery_generator_config.xml', $config1]];
 }