Ejemplo n.º 1
0
 protected function reset()
 {
     $this->id = $this->factory->numberBetween(1, 10000);
     $this->body = $this->serializer->serialize($this->eventBuilder->build());
     $this->type = TransferWasMade::class;
     $this->occurredOn = $this->factory->dateTimeThisMonth;
 }
Ejemplo n.º 2
0
 public function testGetTimeout()
 {
     $client = new Client();
     $expectedTimeout = $this->faker->randomDigit();
     $client->setTimeout($expectedTimeout);
     $this->assertEquals($expectedTimeout, $client->getTimeout());
 }
 public function testGetEntity()
 {
     $controller = new JsonApiController();
     $meta = $this->getMockBuilder("Doctrine\\ORM\\Mapping\\ClassMetadata")->setConstructorArgs(["NwApi\\Entities\\User"])->getMock();
     $di = Di::getInstance();
     $di->em = $this->getMockBuilder('Doctrine\\ORM\\EntityManager')->disableOriginalConstructor()->getMock();
     $di->em->expects($this->any())->method('find')->willReturn(new NwApi\Entities\User());
     $meta->identifier = ['id'];
     $controller->getEntity($meta, [$this->faker->randomDigit()]);
 }
Ejemplo n.º 4
0
 public function run()
 {
     $faker = Factory::create();
     foreach (range(1, 10) as $index) {
         Category::create(['name' => $faker->firstName, 'description' => $faker->text(130), 'active' => $faker->boolean(85)]);
     }
 }
Ejemplo n.º 5
0
 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Product::create(['product_name' => $faker->word, 'details' => $faker->paragraph, 'picture' => 'uploads/products/1default.jpg', 'min_price' => $faker->randomDigit, 'max_price' => $faker->randomDigitNotNull, 'crop_id' => 1, 'location' => $faker->country, 'expiry_date' => $faker->date('Y--m-d')]);
     }
 }
Ejemplo n.º 6
0
 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 500) as $index) {
         Photo::create(array('title' => $faker->sentence($nbwords = 5), 'image' => $faker->imageUrl($width = 640, $height = 480), 'gallery_id' => $faker->numberBetween(1, 50)));
     }
 }
 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Leaveapplication::create([]);
     }
 }
Ejemplo n.º 8
0
 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Version::create([]);
     }
 }
 private function initFaker()
 {
     $this->faker = Faker::create();
     foreach ($this->scope->getCodes() as $code) {
         $this->scopeFaker[$code] = Faker::create($this->scope->getLocale($code));
     }
 }
 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 30) as $index) {
         Lesson::create(['title' => $faker->sentence(5), 'body' => $faker->paragraph(4), 'some_bool' => $faker->boolean()]);
     }
 }
Ejemplo n.º 11
0
 /**
  * Responds to requests to POST /lorem
  */
 public function postGenerate(Request $request)
 {
     // Validate the request data
     // num_users - how many users should be created
     // tb_word_count - how many words in password
     $this->validate($request, ['num_users' => 'required|integer|min:1|max:99', 'tb_word_count' => 'integer|min:1|max:9']);
     $num_users = $request->input('num_users');
     $lang = $request->input('lang');
     $address1 = $request->input('address1');
     $profile = $request->input('profile');
     $tb_word_count = $request->input('tb_word_count');
     $cb_number = $request->input('cb_number');
     $cb_symbol = $request->input('cb_symbol');
     $pwd_case = $request->input('pwd_case');
     //The section below declares the arrays needed to hold random user data
     //and then populates those arrays.
     //instantiate new PwdGenerator object
     $a = new \App\PwdGenerator($tb_word_count, $pwd_case, $cb_number, $cb_symbol);
     $pwd_array = [];
     $faker = \Faker\Factory::create($lang);
     $name_array = [];
     $address_array = [];
     $profile_array = [];
     for ($i = 0; $i < $num_users; $i++) {
         // populate array with random names
         $name_array[$i] = $faker->name;
         //populate array with random address info
         $address_array[$i] = $faker->address;
         //populate array with random profile text
         $profile_array[$i] = $faker->text;
         //populate array with random passwords
         $pwd_array[$i] = $a->generatePwd();
     }
     return view('random.generate')->with('num_users', $num_users)->with('lang', $lang)->with('address1', $address1)->with('profile', $profile)->with('tb_word_count', $tb_word_count)->with('cb_number', $cb_number)->with('cb_symbol', $cb_symbol)->with('pwd_case', $pwd_case)->with('name_array', $name_array)->with('address_array', $address_array)->with('profile_array', $profile_array)->with('pwd_array', $pwd_array);
 }
Ejemplo n.º 12
0
 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     //
     $this->app->singleton(FakerGenerator::class, function () {
         return Factory::create('zh_CN');
     });
 }
 public function testPostItem()
 {
     $client = static::createClient();
     $faker = Factory::create();
     $client->request('POST', '/api/items', array('name' => $faker->name, 'description' => $faker->text));
     $this->assertEquals(201, $client->getResponse()->getStatusCode());
 }
Ejemplo n.º 14
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     for ($i = 0; $i < 40; $i++) {
         \DB::table('usuarios')->insert(array('snombre' => $faker->firstname, 'sapellido' => $faker->lastname, 'scontrasena' => \Hash::make('12345'), 'scorreo' => $faker->unique()->email, 'badministra' => 0));
     }
 }
Ejemplo n.º 15
0
 public function setUp()
 {
     date_default_timezone_set('Europe/Berlin');
     $faker = Factory::create();
     $this->veryLongString = preg_replace("/[^A-Za-z0-9]/", '', $faker->sentence(90));
     $this->faker = $faker;
 }
Ejemplo n.º 16
0
 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Stockpackage::create([]);
     }
 }
Ejemplo n.º 17
0
 public function run()
 {
     $faker = Faker::create();
     for ($i = 0; $i < 50; $i++) {
         \DB::table('states')->insert(array('state' => $faker->unique()->state, 'code' => $faker->postcode));
     }
 }
Ejemplo n.º 18
0
 public function run()
 {
     $faker = Faker::create();
     for ($index = 0; $index < 20; $index++) {
         oferta::create(array("oferta" => $faker->title, "descripcion" => $faker->sentence(20), "empresa" => $faker->company, "telefono" => $faker->phoneNumber, "email" => $faker->email, "url" => $faker->url, "tipo_contrato" => $faker->city, "duracion" => $faker->text, "jornada" => $faker->text, "salario" => $faker->text, "fecha" => $faker->dateTime, "id_usuario" => 1));
     }
 }
Ejemplo n.º 19
0
 protected function setUp()
 {
     if (!static::$staticConnection) {
         static::$staticConnection = new Connection($this->server, $this->dbName);
     }
     $this->connection = static::$staticConnection;
     if (!static::$staticFaker) {
         static::$staticFaker = Factory::create();
     }
     if (!static::$staticMongator) {
         static::$staticMongator = new Mongator(new $this->metadataFactoryClass());
         static::$staticMongator->setConnection('default', $this->connection);
         static::$staticMongator->setDefaultConnectionName('default');
     }
     if (!static::$staticConfigClasses) {
         static::$staticConfigClasses = (require __DIR__ . '/../../configClasses.php');
     }
     $this->faker = static::$staticFaker;
     $this->mongator = static::$staticMongator;
     $this->unitOfWork = $this->mongator->getUnitOfWork();
     $this->metadataFactory = $this->mongator->getMetadataFactory();
     $this->cache = $this->mongator->getFieldsCache();
     foreach ($this->mongator->getAllRepositories() as $repository) {
         $repository->getIdentityMap()->clear();
     }
     $this->mongo = $this->connection->getMongo();
     $this->db = $this->connection->getMongoDB();
     foreach ($this->db->listCollections() as $collection) {
         //  $collection->drop();
     }
 }
Ejemplo n.º 20
0
 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 50) as $index) {
         User::create(['github_id' => $index, 'github_url' => $faker->url(), 'city' => $faker->city(), 'name' => $faker->userName(), 'twitter_account' => $faker->userName(), 'company' => $faker->userName(), 'personal_website' => $faker->url(), 'signature' => $faker->sentence(), 'introduction' => $faker->sentence(), 'email' => $faker->email()]);
     }
 }
Ejemplo n.º 21
0
 public function load(ObjectManager $manager)
 {
     $faker = Factory::create();
     for ($i = 0; $i < 50; $i++) {
         static $id = 1;
         $post = new Post();
         $post->setTitle($faker->sentence);
         $post->setAuthorEmail('*****@*****.**');
         $post->setImageName("images/post/foto{$id}.jpg");
         $post->setContent($faker->realText($maxNbChars = 5000, $indexSize = 2));
         $marks = array();
         for ($q = 0; $q < rand(1, 10); $q++) {
             $marks[] = rand(1, 5);
         }
         $post->setMarks($marks);
         $post->addMark(5);
         $manager->persist($post);
         $this->addReference("{$id}", $post);
         $id = $id + 1;
         $rand = rand(3, 7);
         for ($j = 0; $j < $rand; $j++) {
             $comment = new Comment();
             $comment->setAuthorEmail('*****@*****.**');
             $comment->setCreatedBy('user_user');
             $comment->setContent($faker->realText($maxNbChars = 500, $indexSize = 2));
             $comment->setPost($post);
             $post->getComments()->add($comment);
             $manager->persist($comment);
             $manager->flush();
         }
     }
     $manager->flush();
 }
Ejemplo n.º 22
0
 /**
  * Build a new Seed.
  */
 public function __construct()
 {
     // Bind Faker instance if available
     if (class_exists('Faker\\Factory')) {
         $this->faker = Faker::create();
     }
 }
Ejemplo n.º 23
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     // Validate form
     $this->validate($request, ['user_quantity' => 'required|integer|between:1,100']);
     // Assign variables
     $form_array = $request->input('form_array', array());
     $user_quantity = $request->input('user_quantity');
     // Generate Fake User Data
     $faker = Factory::create('en_US');
     $payload = array();
     $deposit_address = in_array('address', $form_array);
     $deposit_phone = in_array('phone', $form_array);
     $deposit_birthdate = in_array('birthdate', $form_array);
     for ($i = 0; $i < $user_quantity; $i++) {
         $individual = array();
         $individual[] = $faker->name;
         if ($deposit_address) {
             $individual[] = $faker->address;
         }
         if ($deposit_phone) {
             $individual[] = $faker->phoneNumber;
         }
         if ($deposit_birthdate) {
             $individual[] = $faker->date($format = 'Y-m-d', $max = 'now');
         }
         // Append to payload array
         $payload[] = $individual;
     }
     // Push data to view and return view
     return view('results', ['payload' => $payload, 'source' => 'fake-user', 'title' => 'Fake User Generator']);
 }
Ejemplo n.º 24
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     for ($i = 0; $i < 20; $i++) {
         DB::table('stores')->insert([['brand_id' => rand(1, 10), 'payment_type' => rand(1, 3), 'store_name' => $faker->company . ' Store', 'address' => $faker->address, 'latitude' => $faker->latitude, 'longitude' => $faker->longitude, 'opening_time' => 10 + rand(1, 3), 'closing_time' => 20 + rand(1, 3), 'highlights' => 'Ready made', 'price_range' => 1000 + rand(100, 600) . '-' . (10000 + rand(1500, 1900)), 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]]);
     }
 }
Ejemplo n.º 25
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::Create();
     $name = $faker->name;
     Eloquent::unguard();
     Writers::create(['name' => $name, 'bio' => 'This is just a sample Writer. There is nothing to say here!', 'image' => '/images/writers/SampleWriter.jpg', 'slug' => str_replace(' ', '-', $name)]);
 }
Ejemplo n.º 26
0
 public function testSkillFormatter()
 {
     $faker = Factory::create();
     $faker->addProvider(new PersonExtra($faker));
     $fullName = $faker->fullName();
     print_r($fullName);
 }
Ejemplo n.º 27
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     for ($i = 0; $i < 30; $i++) {
         Vehicle::create(['color' => $faker->safeColorName(), 'power' => $faker->randomNumber(), 'capacity' => $faker->randomFloat(), 'speed' => $faker->randomFloat(), 'maker_id' => $faker->numberBetween(1, 5)]);
     }
 }
Ejemplo n.º 28
0
 public function run()
 {
     $faker = Faker::create();
     $log = new Stream('php://stdout');
     $log->info('Start ' . __CLASS__);
     /** @var Phalcon\Db\AdapterInterface $database */
     $database = $this->getDI()->get('db');
     $userIds = Users::find(['columns' => 'id'])->toArray();
     $database->begin();
     for ($i = 0; $i <= self::POSTS_TOTAL; $i++) {
         $title = $faker->company;
         $userRandId = array_rand($userIds);
         $posts = new Posts();
         $posts->usersId = $userIds[$userRandId]['id'];
         $posts->type = rand(0, 1) ? 'questions' : 'tips';
         $posts->title = $title;
         $posts->slug = \Phalcon\Tag::friendlyTitle($title);
         $posts->numberViews = rand(5, 100);
         $posts->numberReply = rand(0, 20);
         $posts->content = $faker->text;
         $posts->sticked = 'N';
         $posts->status = 'A';
         $posts->locked = 'N';
         $posts->deleted = 0;
         $posts->acceptedAnswer = 'N';
         if (!$posts->save()) {
             var_dump($posts->getMessages());
             $database->rollback();
             die;
         }
         $log->info('posts: ' . $posts->getTitle());
     }
 }
Ejemplo n.º 29
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     for ($i = 0; $i < 40; $i++) {
         $bank_account = Bank_account::create(['user_id' => $faker->numberBetween(1, 23), 'fi_id' => $faker->numberBetween(1, 3), 'account_number' => $faker->regexify('[0-9]+\\-[0-9]{2,4}'), 'account_type_id' => $faker->numberBetween(1, 4), 'currency_id' => $faker->numberBetween(1, 4), 'transaction_limit' => 50, 'daily_limit' => 1000, 'is_primary' => TRUE]);
     }
 }
Ejemplo n.º 30
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('tbl_users')->truncate();
     $faker = \Faker\Factory::create();
     for ($i = 0; $i < 10; $i++) {
         switch (mt_rand(1, 4)) {
             case 1:
                 $insertion = 'van';
                 break;
             case 2:
                 $insertion = 'de';
                 break;
             case 3:
                 $insertion = 'van der';
                 break;
             default:
                 $insertion = '';
         }
         $city2 = "";
         $street2 = "";
         $house_nr2 = "";
         $postalcode2 = "";
         if (mt_rand(1, 2) == 1) {
             $street2 = $faker->streetName;
             $house_nr2 = $faker->numberBetween(0, 2000);
             $postalcode2 = $faker->postcode;
             $city2 = $faker->city;
         }
         \App\User::create(['username' => $faker->userName, 'password' => password_hash('password', PASSWORD_DEFAULT), 'email' => $faker->email, 'firstname' => $faker->firstName, 'lastname' => $faker->lastName, 'insertion' => $insertion, 'phone_nr' => $faker->phoneNumber, 'birthdate' => $faker->date($format = 'Y-m-d', $max = 'now') . " " . $faker->time($format = 'H:i:s', $max = 'now'), 'city' => $faker->city, 'street' => $faker->streetName, 'house_nr' => $faker->numberBetween(0, 2000), 'postalcode' => $faker->postcode, 'city2' => $city2, 'street2' => $street2, 'house_nr2' => $house_nr2, 'postalcode2' => $postalcode2]);
     }
 }