public function test_execute_failure()
 {
     $test = \DB\Scoop\Test::fetch_one();
     $this->expectException(\Scoop\Exception\Database\Mysql::class);
     $this->expectExceptionCode(1062);
     $this->expectExceptionMessageRegExp("/.*Duplicate entry '\\d*' for key '\\w*'.*/i");
     \DB\Scoop\Test::query("INSERT INTO\n              scoop.test\n             (id)\n             VALUES\n             (?)", [$test->id]);
 }
 public function test_is_loaded_from_db()
 {
     $generic = new Generic();
     $this->assertFalse($generic->get_loaded_from_database(), "created models should not be marked loaded from the database");
     $this->assertTrue(\DB\Scoop\Test::fetch_one()->get_loaded_from_database(), "fetched models should be marked as loaded from the database");
 }
Exemple #3
0
 public function test_has_id()
 {
     $test = new Test();
     $this->assertFalse($test->has_id(), "models without an id should say they don't have an id");
     $test = Test::fetch_one();
     $this->assertTrue($test->has_id(), "models with an id should say they have an id");
 }