Esempio n. 1
0
 /**
  * Setup the test environment.
  */
 public function setUp()
 {
     parent::setUp();
     $this->artisan('migrate', ['--database' => 'testbench', '--realpath' => realpath(__DIR__ . '/migrations')]);
     $faker = Factory::create();
     $faker->seed(1234);
     Post::unguard();
     for ($i = 0; $i < 100; $i++) {
         Post::create(['title' => $faker->sentence, 'body' => $faker->text, 'visible' => $faker->boolean(75), 'created_at' => $faker->dateTimeBetween('-30 years', 'now')]);
     }
     Post::reguard();
 }
Esempio n. 2
0
 /** @test */
 function it_applies_a_query_encoded_in_the_url()
 {
     $this->get('api/posts?query=[["where",["visible","=",false]],["limit",[20]]]')->seeJsonEquals(Post::where('visible', '=', false)->limit(20)->get()->toArray());
 }