/**
  * Regression test for issue #27
  * @see https://github.com/Vinelab/NeoEloquent/issues/27
  */
 public function testDoesntCrashOnNonIntIds()
 {
     $u = User::create([]);
     $id = (string) $u->id;
     $found = User::where('id', "{$id}")->first();
     $this->assertEquals($found, $u);
     $foundAgain = User::where('id(individual)', "{$id}")->first();
     $this->assertEquals($foundAgain, $u);
 }
 /**
  * @expectedException \Illuminate\Database\Eloquent\ModelNotFoundException
  */
 public function testFindingAndFailing()
 {
     User::findOrFail(0);
 }
Beispiel #3
0
 /**
  * Regression test for issue #41
  *
  * @see https://github.com/Vinelab/NeoEloquent/issues/41
  */
 public function testWhereWithIn()
 {
     $ab = User::where('alias', 'IN', ['ab'])->first();
     $this->assertEquals($this->ab, $ab);
     $users = User::where('alias', 'IN', ['cd', 'ef'])->get();
     $l = (new User())->getConnection()->getQueryLog();
     $this->assertEquals($this->cd->toArray(), $users[0]->toArray());
     $this->assertEquals($this->ef->toArray(), $users[1]->toArray());
 }
 public function testWhereNotFound()
 {
     $u = User::where('id', '<', 1)->get();
     $this->assertCount(0, $u);
     $u2 = User::where('glasses', 'always on')->first();
     $this->assertNull($u2);
 }