/**
  * Get localized random labels
  *
  * @return array
  */
 protected function getLocalizedRandomLabels()
 {
     $locales = $this->getLocales();
     $labels = [];
     foreach ($locales as $locale) {
         $labels[$locale->getCode()] = $this->faker->sentence(2);
     }
     return $labels;
 }
Beispiel #2
0
 /**
  * @covers \Glue\Storage\Blob::save
  */
 public function testSave()
 {
     $data = $this->faker->sentence();
     $result = $this->blob->save($data);
     $this->assertNotEquals(false, $result);
     $this->assertInternalType('array', $result);
     $this->assertArrayHasKey('0', $result);
     $this->assertArrayHasKey('1', $result);
     $this->assertEquals(strlen($data), $result[1]);
 }
 /**
  * @param FactoryInterface $paymentMethodFactory
  * @param RepositoryInterface $localeRepository
  */
 public function __construct(FactoryInterface $paymentMethodFactory, RepositoryInterface $localeRepository)
 {
     $this->paymentMethodFactory = $paymentMethodFactory;
     $this->localeRepository = $localeRepository;
     $this->faker = \Faker\Factory::create();
     $this->optionsResolver = (new OptionsResolver())->setDefault('name', function (Options $options) {
         return $this->faker->words(3, true);
     })->setDefault('code', function (Options $options) {
         return StringInflector::nameToCode($options['name']);
     })->setDefault('description', function (Options $options) {
         return $this->faker->sentence();
     })->setDefault('gateway', 'offline')->setDefault('enabled', function (Options $options) {
         return $this->faker->boolean(90);
     })->setAllowedTypes('enabled', 'bool');
 }
 /**
  * @param FactoryInterface $shippingMethodFactory
  * @param RepositoryInterface $zoneRepository
  * @param RepositoryInterface $shippingCategoryRepository
  * @param RepositoryInterface $localeRepository
  */
 public function __construct(FactoryInterface $shippingMethodFactory, RepositoryInterface $zoneRepository, RepositoryInterface $shippingCategoryRepository, RepositoryInterface $localeRepository)
 {
     $this->shippingMethodFactory = $shippingMethodFactory;
     $this->localeRepository = $localeRepository;
     $this->faker = \Faker\Factory::create();
     $this->optionsResolver = (new OptionsResolver())->setDefault('code', function (Options $options) {
         return StringInflector::nameToCode($options['name']);
     })->setDefault('name', function (Options $options) {
         return $this->faker->words(3, true);
     })->setDefault('description', function (Options $options) {
         return $this->faker->sentence();
     })->setDefault('enabled', function (Options $options) {
         return $this->faker->boolean(90);
     })->setAllowedTypes('enabled', 'bool')->setDefault('zone', LazyOption::randomOne($zoneRepository))->setAllowedTypes('zone', ['null', 'string', ZoneInterface::class])->setNormalizer('zone', LazyOption::findOneBy($zoneRepository, 'code'))->setDefined('shipping_category')->setAllowedTypes('shipping_category', ['null', 'string', ShippingCategoryInterface::class])->setNormalizer('shipping_category', LazyOption::findOneBy($shippingCategoryRepository, 'code'))->setDefault('calculator', function (Options $options) {
         return ['type' => DefaultCalculators::FLAT_RATE, 'configuration' => ['amount' => $this->faker->randomNumber(4)]];
     });
 }
 /**
  * Generate value content based on backend type
  *
  * @param AbstractAttribute $attribute
  * @param string            $key
  *
  * @return string
  */
 protected function generateValueData(AbstractAttribute $attribute, $key)
 {
     $data = "";
     if (isset($this->forcedValues[$attribute->getCode()])) {
         return $this->forcedValues[$attribute->getCode()];
     }
     switch ($attribute->getBackendType()) {
         case "varchar":
             $validationRule = $attribute->getValidationRule();
             switch ($validationRule) {
                 case 'url':
                     $data = $this->faker->url();
                     break;
                 default:
                     $data = $this->faker->sentence();
                     break;
             }
             break;
         case "text":
             $data = $this->faker->sentence();
             break;
         case "date":
             $data = $this->faker->dateTimeBetween($attribute->getDateMin(), $attribute->getDateMax());
             $data = $data->format('Y-m-d');
             break;
         case "metric":
         case "decimal":
         case "prices":
             if ($attribute->getBackendType() && preg_match('/-' . self::METRIC_UNIT . '$/', $key)) {
                 $data = $attribute->getDefaultMetricUnit();
             } else {
                 $min = $attribute->getNumberMin() != null ? $attribute->getNumberMin() : self::DEFAULT_NUMBER_MIN;
                 $max = $attribute->getNumberMax() != null ? $attribute->getNumberMax() : self::DEFAULT_NUMBER_MAX;
                 $decimals = $attribute->isDecimalsAllowed() ? self::DEFAULT_NB_DECIMALS : 0;
                 $data = $this->faker->randomFloat($decimals, $min, $max);
             }
             break;
         case "boolean":
             $data = $this->faker->boolean() ? "1" : "0";
             break;
         case "option":
         case "options":
             $options = [];
             foreach ($attribute->getOptions() as $option) {
                 $options[] = $option;
             }
             $option = $this->faker->randomElement($options);
             if (is_object($option)) {
                 $data = $option->getCode();
             }
             break;
         default:
             $data = '';
             break;
     }
     return (string) $data;
 }
 /**
  * {@inheritdoc}
  */
 protected function configureOptions(OptionsResolver $resolver)
 {
     $resolver->setDefault('name', function (Options $options) {
         return $this->faker->words(3, true);
     })->setDefault('code', function (Options $options) {
         return StringInflector::nameToCode($options['name']);
     })->setDefault('description', function (Options $options) {
         return $this->faker->sentence();
     })->setDefault('gateway', 'offline')->setDefault('enabled', function (Options $options) {
         return $this->faker->boolean(90);
     })->setDefault('channels', LazyOption::all($this->channelRepository))->setAllowedTypes('channels', 'array')->setNormalizer('channels', LazyOption::findBy($this->channelRepository, 'code'))->setAllowedTypes('enabled', 'bool');
 }
 public function load(ObjectManager $manager)
 {
     $faker = new Faker\Generator();
     $faker->addProvider(new Faker\Provider\en_US\Text($faker));
     $faker->addProvider(new Faker\Provider\Lorem($faker));
     for ($i = 1; $i <= 100; $i++) {
         $post = new Post();
         $post->setTitle($faker->sentence(4));
         $post->setBody($faker->realText(500));
         $manager->persist($post);
     }
     $manager->flush();
 }
Beispiel #8
0
 private function resolveConfigType($config)
 {
     switch ($config['type']) {
         case "url":
             return $this->faker->url;
         case "image":
             $width = isset($config['options']['width']) ? $config['options']['width'] : 800;
             $height = isset($config['options']['height']) ? $config['options']['height'] : 400;
             return $this->faker->imageUrl($width, $height);
         case "page_select":
             $page = ['title' => $this->faker->sentence(), 'body' => $this->faker->text(6000), 'slug' => $this->faker->slug, 'created' => $this->faker->date()];
             return $page;
         case "product_category_select":
         case "collection_select":
             $category = ["name" => $this->faker->word, "slug" => $this->faker->slug];
             return $category;
         case "product_select":
             return $this->tdk->makeProduct();
         default:
             return $this->faker->word;
     }
 }
 /**
  * {@inheritdoc}
  */
 protected function configureOptions(OptionsResolver $resolver)
 {
     $resolver->setDefault('code', function (Options $options) {
         return StringInflector::nameToCode($options['name']);
     })->setDefault('name', $this->faker->words(3, true))->setDefault('description', $this->faker->sentence())->setDefault('usage_limit', null)->setDefault('coupon_based', false)->setDefault('exclusive', $this->faker->boolean(25))->setDefault('priority', 0)->setDefault('starts_at', null)->setAllowedTypes('starts_at', ['null', 'string'])->setDefault('ends_at', null)->setAllowedTypes('ends_at', ['null', 'string'])->setDefault('channels', LazyOption::all($this->channelRepository))->setAllowedTypes('channels', 'array')->setNormalizer('channels', LazyOption::findBy($this->channelRepository, 'code'))->setDefined('rules')->setNormalizer('rules', function (Options $options, array $rules) {
         if (empty($rules)) {
             return [[]];
         }
         return $rules;
     })->setDefined('actions')->setNormalizer('actions', function (Options $options, array $actions) {
         if (empty($actions)) {
             return [[]];
         }
         return $actions;
     });
 }
 /**
  * {@inheritdoc}
  */
 protected function configureOptions(OptionsResolver $resolver)
 {
     $resolver->setDefault('code', function (Options $options) {
         return StringInflector::nameToCode($options['name']);
     })->setDefault('name', function (Options $options) {
         return $this->faker->words(3, true);
     })->setDefault('description', function (Options $options) {
         return $this->faker->sentence();
     })->setDefault('enabled', function (Options $options) {
         return $this->faker->boolean(90);
     })->setAllowedTypes('enabled', 'bool')->setDefault('zone', LazyOption::randomOne($this->zoneRepository))->setAllowedTypes('zone', ['null', 'string', ZoneInterface::class])->setNormalizer('zone', LazyOption::findOneBy($this->zoneRepository, 'code'))->setDefined('shipping_category')->setAllowedTypes('shipping_category', ['null', 'string', ShippingCategoryInterface::class])->setNormalizer('shipping_category', LazyOption::findOneBy($this->shippingCategoryRepository, 'code'))->setDefault('calculator', function (Options $options) {
         $configuration = [];
         /** @var ChannelInterface $channel */
         foreach ($options['channels'] as $channel) {
             $configuration[$channel->getCode()] = ['amount' => $this->faker->randomNumber(4)];
         }
         return ['type' => DefaultCalculators::FLAT_RATE, 'configuration' => $configuration];
     })->setDefault('channels', LazyOption::all($this->channelRepository))->setAllowedTypes('channels', 'array')->setNormalizer('channels', LazyOption::findBy($this->channelRepository, 'code'));
 }
Beispiel #11
0
 public function getDummyData(Generator $faker, array $customValues = array())
 {
     return ['title' => $faker->sentence(), 'status' => $faker->randomElement(['open', 'open', 'closed']), 'user_id' => $this->getRandom('User')->id];
 }
 public function getDummyData(Generator $faker)
 {
     return ["title" => $faker->sentence(), "status" => $faker->randomElement(["open", "closed"]), "user_id" => $this->getRandomId("User")];
 }
 /**
  * @param int $wordCount
  * @return string
  */
 public function getSentence($wordCount)
 {
     return $this->faker->sentence(max($wordCount, 1));
 }
 public function getDummyData(Generator $faker, array $valoresPersonalizados = array())
 {
     return ['titulo' => $faker->sentence(), 'estado' => $faker->randomElement(['abierto', 'cerrado']), 'user_id' => $this->getRandom('User')->id];
 }
 /**
  * @param string $endpoint
  * @return RequestInterface
  */
 private function newApiRequest($endpoint)
 {
     $request = (new Request($endpoint))->withMethod('POST')->withHeader('Content-Type', 'application/x-www-form-urlencoded');
     $request->getBody()->write(http_build_query(['data' => $this->faker->sentence(rand(3, 6))]));
     return $request;
 }
Beispiel #16
0
 /**
  * Create a random CompanyProfile field.
  *
  * @param VisualAppeal\Connect\Company $company (Default: null, newly created)
  * @param VisualAppeal\Connect\User $user (Default: null, newly created)
  *
  * @return VisualAppeal\Connect\CompanyProfile
  */
 protected function createCompanyProfile($company = null, $user = null)
 {
     $user = $user ?: $this->createUser();
     $company = $company ?: $this->createCompany($user);
     return \VisualAppeal\Connect\CompanyProfile::create(['company_id' => $company->id, 'title' => strtolower($this->faker->word), 'value' => $this->faker->sentence($this->faker->numberBetween(1, 2)), 'translatable' => false]);
 }
 public function getDummyData(Generator $faker, array $customValues = [])
 {
     return ['reference' => $faker->randomNumber(4), 'name' => $faker->sentence(2), 'description' => $faker->paragraph(1)];
 }
 protected function generateList(array $data = [])
 {
     $data = array_merge(['name' => $this->faker->text(20), 'contact' => ['company' => $this->faker->company, 'address1' => $this->faker->streetAddress, 'address2' => $this->faker->secondaryAddress, 'city' => $this->faker->city, 'state' => $this->faker->state, 'zip' => $this->faker->postcode, 'country' => 'US', 'phone' => $this->faker->phoneNumber], 'permission_reminder' => $this->faker->text(50), 'use_archive_bar' => false, 'campaign_defaults' => ['from_name' => $this->faker->name, 'from_email' => $this->faker->email, 'subject' => $this->faker->sentence(5), 'language' => 'en'], 'notify_on_subscribe' => '', 'notify_on_unsubscribe' => '', 'email_type_option' => false, 'visibility' => 'pub'], $data);
     return $data;
 }
 /**
  * Gets a random sentence
  * 
  * @param Faker\Generator
  * @return string
  */
 public function getFakeData(Generator $faker)
 {
     return $faker->sentence(rand(2, 6));
 }
 /**
  * @return Order
  */
 protected function getRandomOrder()
 {
     $order = new Order();
     $order->setId($this->faker->numerify('####'))->setAmount($this->faker->randomFloat(2, 1, 100))->setCurrency('CHF')->setOrderText($this->faker->sentence(4));
     return $order;
 }
 /**
  * Generate a changelog entry.
  *
  * @param $type
  *
  * @return string
  */
 protected function generate_changelog_entry($type)
 {
     $type = ucfirst($type);
     return "{$type}: {$this->faker->sentence(rand(5, 10))}";
 }
 /**
  * @param string $youtubeId
  * @return string
  */
 public function getTextFromSubtitles($youtubeId)
 {
     return $this->faker->sentence(100);
 }
Beispiel #23
0
 public function getDummyData(\Faker\Generator $faker, array $customValues = array())
 {
     return ['name' => $faker->sentence(2), 'type' => $faker->randomElement(['DIG', 'DIG', 'CRE']), 'description' => $faker->paragraph(3), 'objectives' => $faker->paragraph(6), 'status' => $faker->randomElement([false, false, true]), 'customer_id' => $this->getRandom('Customer')->id];
 }
Beispiel #24
0
 protected function fillVideo(Video $v)
 {
     $v->title = $this->faker->catchPhrase();
     $v->description = $this->faker->sentence(20);
     $v->youtubeId = 'AuX7nPBqDts';
 }
 public function getDummyData(Generator $faker, array $customValues = array())
 {
     return ['cantidad' => $faker->randomNumber($nbDigits = 1), 'peso' => $faker->randomNumber($nbDigits = 2), 'envio' => $faker->word, 'descripcion' => $faker->sentence($nbWords = 6), 'entrega_id' => $this->getRandom('Entrega')->id];
 }
 public function getDummyData(Generator $faker, array $custom = [])
 {
     return ['name' => $faker->colorName, 'description' => $faker->sentence(5), 'user_id' => $this->random('User')->id];
 }
Beispiel #27
0
    public function getArticleText(Generator $faker)
    {
        $header1 = $faker->sentence();
        $header2 = $faker->sentence();
        $articleText = <<<ARTICLE
# {$header1}

## {$header2}

Lorem markdownum parte, **ad** harena clausit: quae nullo magnae. Sunt timentem
virorum. Tu autem de limite valentior ullis nives, sole dixit, rasilis his
viridesque. Te [equique merui ovantem](http://haskell.org/) deus caespite.

``` php
addressSearch += server_hfs;
debuggerAlphaIcq.blacklist(575642 + memoryFddi(rte_ipod_analyst, -1),
        wpaDocument * floatingSubnet);
if (unix_ipx_version.webcamWebsiteToken.gateway(componentUltra, asp, 1) <=
        flashVdslEbook) {
    lion_telecommunications_wheel.serialFileRom += sql;
} else {
    crossplatform_card += fullFileHeuristic - warmIconMacro;
    dsl.online_boot = point + serverBitMemory(aspUncOverwrite, right,
            real_lamp);
    bittorrentAddressDdr(bounce_schema, drive);
}
var bookmark_key = outputCompression.scsi(link_primary_error);
```

## Mentem oro herbida mihi has nihil lapillos

Hymenaee et victa Argolica respiramina nomen aditu eam gemma tantum. Fera in
quid **nihil** cervix inde; turis velocibus conplexa.

## Sanguine miseranda rore

Ore quam, deos nitido Andraemon terris gravitate nati manusque fert; dolendi.
Fiuntque et Iolao *totumque*; virisque aquas et nomina et **ut** videt, te
cristis ipse. Vero audaci querorque sanguine roganti reclusa, niveis esse
pignora duxere. Nodosque moderere Titan illis dilacerant, herba *memorant*
nostris.

## Et crescendo vectus adgreditur

Secura vel tua cumque fuisses natura, dederant cunctisque illa, utraque. Mortali
hanc motu nec templi intrat! Iove simul cervus meorum?

## Semiferos non

*Pedibus* credule sibi Delius pennas condebat qua visus echidnae gurgite septem.
Pro conata felix Aetna frustra quantum? Cuius non magnumque corpore; faucibus
nudos hos at redeuntque foedus armento parabat habet amplexibus manus armigerae.
Me neque famulos terras iniuria, nullis corpora forma *per*, iam coronae crura
paenitet utraque fagus contra. Veri a superis Heliadum totidem Cyllaron formae
toro umeri superest, quamlibet.

    ```php
    dns = 2 + accessUnmountTft - nanometer_wan;
    if (ofRestoreHdd == encoding_pram_subdirectory) {
        mysql.device -= ram_dos;
        lossy.favorites_matrix_https(toslink_visual_rdf + rpmCmyk);
        retina_lion = dramHsf;
    } else {
        solid += progressivePcmcia(2, appletVirus, hard_gps_byte);
        overclocking_mp = wikiDdl;
        interpreter_keylogger.clipboard_markup = 1;
    }
    phishingNavigation = 3;
    ```

Mihi acta gratia, sagittas loqui, monimenta tamen et Aeacus. Nomina unum imber
inpiger bellum gravis gravis ideoque nova sub strenua suum.
ARTICLE;
        return $articleText;
    }
 /**
  * Generate a text product value data
  *
  * @return string
  */
 protected function generateTextData()
 {
     return $this->faker->sentence();
 }
 /**
  * Create a new (fake) product
  * 
  * @return Product
  */
 protected function create()
 {
     return new Product($this->faker->sentence(3), $this->faker->imageUrl(), $this->faker->paragraph(3));
 }