示例#1
0
 public function testCustomBuilder()
 {
     Phactory::reset();
     Phactory::builder(new CustomBuilder());
     $cake = Phactory::cake();
     $this->assertInstanceOf('CustomObject', $cake);
 }
 protected function tearDown()
 {
     Phactory::reset();
     $this->pdo->exec("DROP TABLE users");
     $this->pdo->exec("DROP TABLE images");
     $this->pdo->exec("DROP TABLE users_images");
 }
示例#3
0
 protected function tearDown()
 {
     Phactory::reset();
     $this->db->users->drop();
     $this->db->roles->drop();
     $this->mongo->close();
 }
示例#4
0
 public function testCustomDependencyClass()
 {
     Phactory::reset();
     Phactory::$dependencyClass = 'CustomDependency';
     $entry = Phactory::entry(array('budget' => Phactory::budget(array('amount' => null))));
     $this->assertNull($entry->budget_amount);
 }
 public function testMultiLevelDependencyWithMethodCalls()
 {
     Phactory::reset();
     Phactory::builder(new TestBuilder());
     $entry = Phactory::entry();
     $this->assertSame($entry->designer, $entry->design->attachment->creator());
 }
示例#6
0
 public static function setUpBeforeClass()
 {
     // create a db connection and tell Phactory to use it
     $mongo = new Mongo();
     Phactory::setConnection($mongo->test_db);
     // reset any existing blueprints and empty any tables Phactory has used
     Phactory::reset();
 }
示例#7
0
 public function testTriggersWithVariation()
 {
     Phactory::reset();
     Phactory::triggers(new FrameworkTriggers());
     $account = Phactory::account('system');
     $this->assertEquals($account->id, 1);
     $this->assertTrue($account->beforeSave);
     $this->assertTrue($account->afterSave);
     $this->assertTrue($account->systemBeforeSave);
     $this->assertTrue($account->systemAfterSave);
 }
 public function setup()
 {
     Phactory::reset();
 }
示例#9
0
 /**
  * Tears down the fixture, for example, closes a network connection.
  * This method is called after a test is executed.
  */
 protected function tearDown()
 {
     Phactory::reset();
     $this->pdo->exec("DROP TABLE `users`");
     $this->pdo->exec("DROP TABLE `roles`");
 }
示例#10
0
 public function setup()
 {
     Phactory::reset();
     Phactory::builder(new OreBuilder());
 }