public function tearDown() { Phactory::recall(); }
public function testRecall() { $name = 'testuser'; // define and create user in db Phactory::define('user', array('name' => $name)); $user = Phactory::create('user'); // recall() deletes from the db Phactory::recall(); // test that the object is gone from the db $stmt = $this->pdo->query("SELECT * FROM `users`"); $db_user = $stmt->fetch(); $this->assertFalse($db_user); // test that the blueprints weren't destroyed too $user = Phactory::create('user'); $this->assertEquals($user->name, $name); }
public function testRecall() { $name = 'testuser'; // define and create user in db Phactory::define('user', array('name' => $name)); $user = Phactory::create('user'); // recall() deletes from the db Phactory::recall(); // test that the object is gone from the db $db_user = $this->db->users->findOne(); $this->assertNull($db_user); // test that the blueprints weren't destroyed too $user = Phactory::create('user'); $this->assertEquals($user['name'], $name); }