コード例 #1
0
 public function tearDown()
 {
     Phactory::recall();
 }
コード例 #2
0
ファイル: PhactoryTest.php プロジェクト: nrocy/phactory
 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);
 }
コード例 #3
0
ファイル: PhactoryMongoTest.php プロジェクト: nrocy/phactory
 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);
 }