Esempio n. 1
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");
 }
Esempio n. 2
0
 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");
 }
Esempio n. 3
0
 public function test_get_sql_history()
 {
     $this->assertEquals([], $this->connection->get_sql_history(), "sql history should be empty if logging is disabled");
     Generic::$connection->set_logging_enabled(true);
     \DB\Scoop\Test::fetch_by_id(1);
     $this->assertNotEmpty(Generic::$connection->get_sql_history(), "sql history should not be empty after enabling logging and running a query");
     Generic::$connection->set_logging_enabled(false);
 }