Esempio n. 1
0
 /** @test */
 public function it_tests_pagination()
 {
     User::create(['id' => 2, 'name' => 'User a 2', 'email' => '*****@*****.**']);
     User::create(['id' => 3, 'name' => 'User a 3', 'email' => '*****@*****.**']);
     User::create(['id' => 4, 'name' => 'User b 4', 'email' => '*****@*****.**']);
     User::create(['id' => 5, 'name' => 'User b 5', 'email' => '*****@*****.**']);
     User::create(['id' => 6, 'name' => 'User b 6', 'email' => '*****@*****.**']);
     sleep(1);
     $this->assertEquals(5, User::count());
     $results = User::paginate(2);
     $this->assertEquals(2, $results->count());
     $this->assertNotNull($results->first()->name);
     $this->assertEquals(5, $results->total());
 }
Esempio n. 2
0
 /**
  * @test
  * @expectedException RatkoR\Crate\QueryException
  * @expectedExceptionMessage cannot cast {bar=test} to string
  */
 public function it_throws_meaningful_error()
 {
     $foo = new stdClass();
     $foo->bar = 'test';
     User::create(['id' => 1, 'name' => $foo, 'email' => '*****@*****.**']);
 }