public function setUp() { $this->faker = Factory::create(); $this->id = TwitterMessageId::create($this->faker->uuid); $this->lang = $this->faker->countryISOAlpha3; $this->userName = $this->faker->userName; $this->hashtagText = $this->faker->word; $this->text = $this->faker->text(); $this->complexText = '@' . $this->userName . ' ' . $this->text . ' #' . $this->hashtagText; $this->date = new \DateTimeImmutable(); $this->coordinates = \Mockery::mock(TwitterCoordinates::class); $this->place = \Mockery::mock(TwitterPlace::class); $this->inReplyToStatusId = $this->faker->randomNumber(); $this->inReplyToUserId = $this->faker->randomNumber(); $this->inReplyToScreenName = $this->faker->userName; $this->retweeted = $this->faker->boolean(); $this->retweetCount = $this->faker->randomNumber(); $this->favorited = $this->faker->boolean(); $this->favoriteCount = $this->faker->randomNumber(); $this->truncated = $this->faker->boolean(); $this->source = null; $this->retweetedStatus = \Mockery::mock(Tweet::class); $this->hashtag = \Mockery::mock(TwitterHashtag::class); $this->userMention = \Mockery::mock(TwitterUserMention::class); $this->sender = \Mockery::mock(TwitterUser::class); $this->recipient = \Mockery::mock(TwitterUser::class); $this->entities = \Mockery::mock(TwitterEntities::class); }
public function editTask(AcceptanceTester $I) { $description = $this->faker->text(100); $I->wantTo('edit a task'); $I->amOnPage('/tasks/1/edit'); $I->seeCurrentUrlEquals('/tasks/1/edit'); $I->fillField('#description', $description); $I->click('Save'); $I->seeInDatabase('tasks', ['description' => $description]); }
/** * Returns default values by given fields * * @param array $fields * @return array */ protected function getDefaultFields(array $fields) { $defaults = array('oxid' => $this->generator->md5, 'oxparentid' => '', 'oxactive' => '1', 'oxtimestamp' => $this->generator->dateTime, 'oxshopid' => 'oxbaseshop', 'oxsort' => $this->generator->randomNumber(), 'oxactivefrom' => '0000-00-00 00:00:00', 'oxactiveto' => '0000-00-00 00:00:00', 'oxdesc' => $this->generator->text(255), 'oxshortdesc' => $this->generator->text(50)); foreach ($defaults as $key => $value) { if (false === in_array($key, $fields)) { unset($defaults[$key]); } } return $defaults; }
public function setUp() { $this->faker = Factory::create(); $this->id = TwitterMessageId::create($this->faker->uuid); $this->userName = $this->faker->userName; $this->hashtagText = $this->faker->word; $this->text = $this->faker->text(); $this->complexText = '@' . $this->userName . ' ' . $this->text . ' #' . $this->hashtagText; $this->date = new \DateTimeImmutable(); $this->hashtag = \Mockery::mock(TwitterHashtag::class); $this->userMention = \Mockery::mock(TwitterUserMention::class); $this->sender = \Mockery::mock(TwitterUser::class); $this->recipient = \Mockery::mock(TwitterUser::class); $this->entities = \Mockery::mock(TwitterEntities::class); }
/** * Generate a string * * @param $schema * @param $required * @param null $property * @return null|string * @throws InvalidArgumentException */ private function handleString($schema, $required, $property = null) { if (!$this->shouldHandle($required)) { return null; } $enum = $this->getEnum($schema); if (null !== $enum) { return $enum; } if ($this->provider->hasProperty($schema, 'pattern')) { $pattern = $this->provider->getProperty($schema, 'pattern'); return $this->generator->regexify($pattern); } if ($this->hasFormatter($schema, $property)) { $formatter = $this->getFormatter($schema, $property); return $formatter(); } $maxLength = $this->provider->getProperty($schema, 'maxLength', $this->config->getMaxLength()); $minLength = $this->provider->getProperty($schema, 'minLength', $this->config->getMinLength()); $text = $this->generator->text($maxLength); while (strlen($text) < $minLength) { $text .= $this->generator->randomLetter; } return $text; }
/** * @param \AcceptanceTester $I */ public function submitASession(AcceptanceTester $I) { $I->am('an attendee'); $I->wantTo('submit a session'); $I->expect('to be able a submit a new session'); // Login user. $I->amOnPage('/user/login'); $I->submitForm('#user-login-form', ['name' => 'user1', 'pass' => '123456']); $I->seeElement('body.user-logged-in'); // Fill session submission. $I->amOnPage('/node/add/session'); $node_title = $this->faker->text(30); $I->fillField('title[0][value]', $node_title); $I->fillCkEditorByName('body[0][value]', $this->faker->text(100)); $I->fillField('field_author[0][target_id]', 'user1 (2)'); $I->selectOption('field_exp_level', 0); $I->selectOption('field_session_track', 'development'); $I->makeScreenshot('session_form'); $I->submitForm('#node-session-form', [], 'op'); $I->makeScreenshot('session_view'); $I->see($node_title, '.l-content'); }
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; } }
private function fillItems(AcceptanceTester $I, $max = 2) { for ($i = 1; $i <= $max; $i++) { $row_selector = sprintf('table.invoice-table tbody tr:nth-child(%d) ', $i); $product_key = $this->faker->text(10); $description = $this->faker->text(80); $unit_cost = $this->faker->randomFloat(2, 0, 100); $quantity = $this->faker->randomDigitNotNull; $I->fillField($row_selector . '#product_key', $product_key); $I->fillField($row_selector . 'textarea', $description); $I->fillField($row_selector . 'td:nth-child(4) input', $unit_cost); $I->fillField($row_selector . 'td:nth-child(5) input', $quantity); } }
public function createQuote(AcceptanceTester $I) { $clientEmail = $this->faker->safeEmail; $productKey = $this->faker->text(10); $I->wantTo('create a quote'); // create client $I->amOnPage('/clients/create'); $I->fillField(['name' => 'contacts[0][email]'], $clientEmail); $I->click('Save'); $I->see($clientEmail); // create product $I->amOnPage('/products/create'); $I->fillField(['name' => 'product_key'], $productKey); $I->fillField(['name' => 'notes'], $this->faker->text(80)); $I->fillField(['name' => 'cost'], $this->faker->numberBetween(1, 20)); $I->click('Save'); $I->wait(1); //$I->see($productKey); // create quote $I->amOnPage('/quotes/create'); $I->selectDropdown($I, $clientEmail, '.client_select .dropdown-toggle'); $I->fillField('table.invoice-table tbody tr:nth-child(1) #product_key', $productKey); $I->click('table.invoice-table tbody tr:nth-child(1) .tt-selectable'); $I->click('Save'); $I->see($clientEmail); // enter payment $clientId = $I->grabFromDatabase('contacts', 'client_id', ['email' => $clientEmail]); $invoiceId = $I->grabFromDatabase('invoices', 'id', ['client_id' => $clientId]); $invitationKey = $I->grabFromDatabase('invitations', 'invitation_key', ['invoice_id' => $invoiceId]); $clientSession = $I->haveFriend('client'); $clientSession->does(function (AcceptanceTester $I) use($invitationKey) { $I->amOnPage('/view/' . $invitationKey); $I->click('Approve'); $I->see('This quote is approved'); }); }
public function setUp() { $this->faker = Factory::create(); $this->message = $this->faker->text(); }
public function getDummyData(Generator $faker, array $customValues = array()) { return ['comunidad' => $faker->company, 'tipo_secretariado_id' => rand(1, 3), 'responsable' => $faker->name($gender = null | 'male' | 'female'), 'direccion' => $faker->randomElement(['Numancia, 22', 'Escaleritas, 128', 'Carvajal, 32']), 'cp' => $faker->randomElement(['35012', '35016', '35018', '35010', '32012']), 'pais_id' => 73, 'provincia_id' => 1, 'localidad_id' => $faker->biasedNumberBetween($min = 1, $max = 34, $function = 'sqrt'), 'email_solicitud' => $faker->email, 'email_envio' => $faker->email, 'web' => $faker->url, 'facebook' => $faker->url, 'telefono1' => $faker->randomElement(['615324789', '928276589', '627456896', '615856912']), 'telefono2' => $faker->randomElement(['', '', '928278956', '928564285']), 'tipo_comunicacion_preferida_id' => rand(1, 2), 'observaciones' => $faker->text($maxNbChars = 200)]; }
public function getDummyData(Generator $faker, array $customValues = array()) { $fecha_inicio = Carbon::createFromDate(2016, 1, 1)->addMonth(rand(0, 11))->addDay(rand(0, 31)); $fecha_final = Carbon::createFromDate($fecha_inicio->year, $fecha_inicio->month, $fecha_inicio->day)->addDay(rand(0, 3)); return ['cursillo' => $faker->catchPhrase, 'fecha_inicio' => $fecha_inicio, 'fecha_final' => $fecha_final, 'descripcion' => $faker->text($maxNbChars = 200), 'comunidad_id' => $this->getRandom('Comunidades')->id, 'tipo_participante_id' => rand(1, 3), 'num_cursillo' => rand(1111, 9999)]; }
public function __invoke(Generator $oFaker) { return [\App\Models\Messages\Message::COLUMN_TEXT => $oFaker->text(200)]; }
/** * Generate a title * * @param int $maxChars Maximum character length of the title * @return string */ public function title($maxChars = 50) { return trim($this->faker->text($maxChars), '.'); }
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; }