예제 #1
0
 public function testRelationOneToOne()
 {
     $q = BookstoreEmployeeQuery::create()->joinBookstoreEmployeeAccount();
     $joins = $q->getJoins();
     $join = $joins['BookstoreEmployeeAccount'];
     $with = new ModelWith($join);
     $this->assertEquals($with->getRelationMethod(), 'setBookstoreEmployeeAccount', 'A ModelWith computes the relation method from the join');
     $this->assertEquals($with->getRelationName(), 'BookstoreEmployeeAccount', 'A ModelWith computes the relation name from the join');
     $this->assertFalse($with->isAdd(), 'A ModelWith computes the relation cardinality from the join');
 }
 public function testDeleteAllFilter()
 {
     BookstoreDataPopulator::depopulate($this->con);
     $manager = new BookstoreManager();
     $manager->save($this->con);
     $cashier1 = new BookstoreCashier();
     $cashier1->save($this->con);
     $cashier2 = new BookstoreCashier();
     $cashier2->save($this->con);
     BookstoreManagerQuery::create()->deleteAll();
     $nbCash = BookstoreEmployeeQuery::create()->count();
     $this->assertEquals(2, $nbCash, 'Delete in sub query affects only child results');
 }
 public function testFindPkSimpleWithSingleTableInheritanceReturnCorrectClass()
 {
     Propel::disableInstancePooling();
     $employee = new BookstoreEmployee();
     $employee->save($this->con);
     $manager = new BookstoreManager();
     $manager->save($this->con);
     $cashier1 = new BookstoreCashier();
     $cashier1->save($this->con);
     $cashier2 = new BookstoreCashier();
     $cashier2->save($this->con);
     $this->assertInstanceOf('BookstoreEmployee', BookstoreEmployeeQuery::create()->findPk($employee->getId()), 'findPk() return right object : BookstoreEmployee');
     $this->assertInstanceOf('BookstoreManager', BookstoreEmployeeQuery::create()->findPk($manager->getId()), 'findPk() return right object : BookstoreManager');
     $this->assertInstanceOf('BookstoreCashier', BookstoreEmployeeQuery::create()->findPk($cashier1->getId()), 'findPk() return right object : BookstoreCashier');
     $this->assertInstanceOf('BookstoreCashier', BookstoreEmployeeQuery::create()->findPk($cashier2->getId()), 'findPk() return right object : BookstoreCashier');
     Propel::enableInstancePooling();
 }