Пример #1
0
 public function testCreateDocuments()
 {
     $num_documents = 30;
     $documents = DataGenerator::createDocuments($this->module, array(DataGenerator::OPTION_COUNT => $num_documents, DataGenerator::OPTION_LOCALE => 'fr_FR'));
     $this->assertTrue($num_documents === count($documents));
     for ($i = 0; $i < $num_documents; $i++) {
         $document = $documents[$i];
         $this->assertTrue($document->isClean(), "New document {$i} should have no changes.");
         $this->assertTrue(0 === count($document->getChanges()), "New document {$i} should have no changes.");
     }
 }
Пример #2
0
 /**
  * Creates `count` number of documents with fake data for the given module.
  *
  * @param IModule $module module to create documents for
  * @param array $options use `count` for number of documents to create. For other options see fill() method.
  *
  * @return array of new documents with fake data
  *
  * @throws \Dat0r\Core\Document\InvalidValueException in case of fake data being invalid for the given field
  * @throws \InvalidArgumentException in case of invalid locale option string
  * @throws \Dat0r\Core\Error\LogicException on AggregateField misconfiguration
  * @throws \Dat0r\Core\Error\InvalidImplementorException on various misconfigurations
  * @throws \Dat0r\Core\Error\ObjectImmutableException if an instance is frozen (closed to modifications)
  */
 public static function createDocuments(IModule $module, array $options = array())
 {
     $data_generator = new DataGenerator();
     return $data_generator->createFakeDocuments($module, $options);
 }