Exemple #1
0
 public function testGetSimpleObject()
 {
     $this->_entity->setId(1);
     $result = $this->_entity->getSimpleObject();
     $expected = new \stdClass();
     $expected->id = 1;
     $this->assertEquals($expected, $result);
 }
 public function testFakeIdModelBindingWorks()
 {
     $model = Fake::create([]);
     $expected = url('fake/' . $model->getRouteKey());
     $actual = route('fake', ['fake' => $model]);
     $this->assertEquals($expected, $actual);
 }
 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 50) as $index) {
         Fake::create(array('name' => $faker->userName(), 'address' => $faker->address(), 'phone' => $faker->phoneNumber(), 'email' => $faker->email(), 'created_at' => $faker->dateTimeBetween('now', '+14 days')));
         // $fake=array(
         // 	'name' => $faker->userName(),
         //        'address' => $faker->address(),
         //        'phone'=>$faker->phoneNumber(),
         //        'email'=>$faker->email(),
         //        'created_at'=>$faker->dateTimeBetween('now', '+14 days')
         // 	);
         // DB::table('fake')->insert($fake);
     }
 }
Exemple #4
0
 public function testRecacheWithHydrate()
 {
     $fake = new Fake();
     $fake_obj = new FakeObject('Herp');
     $hydrated = $fake->getObjectHydrated($fake_obj);
     // call to cache result
     $this->assertFalse($hydrated);
     $fake->remRecache();
     $new_hydrated = $fake->getObjectHydrated($fake_obj);
     $this->assertTrue($new_hydrated);
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $fake = Fake::find($id);
     $fake->delete();
     Session::flash('message', 'Successfully deleted fake data');
     return Redirect::to('fake');
 }
Exemple #6
0
<?php

require '../includes/inc.Vars.php';
class Fake
{
    private $pdo;
    function __construct(PDO $pdo)
    {
        $this->pdo = $pdo;
    }
    function Messages($int)
    {
        try {
            $sql = $this->pdo->prepare("INSERT INTO messages (uniqid, raw, labelIds, threadId, internalDate) VALUES(:uniqid, :raw, :labelIds, :threadId, NOW())");
            $i = 0;
            while ($i < $int) {
                $params = array(':uniqid' => bin2hex(openssl_random_pseudo_bytes(8)), ':raw' => file_get_contents("http://loripsum.net/api/4/long/decorate/link/ul/ol/dl/bq/code/headers/"), ':labelIds' => json_encode(array("UNREAD")), ':threadId' => bin2hex(openssl_random_pseudo_bytes(8)));
                $sql->execute($params);
                $i++;
            }
        } catch (PDOException $e) {
            $msg = '<b>PDO ERROR</b><br />File : ' . $e->getFile() . '<br />Line : ' . $e->getLine() . '<br /> Error : ' . $e->getMessage();
            die($msg);
        }
    }
}
$api = new Fake($pdo);
$api->Messages(4);