/** * */ public function testBigIntIgnoreCaseOrderBy() { // Some sample data $b = new Bookstore(); $b->setStoreName("SortTest1")->setPopulationServed(2000)->save(); $b = new Bookstore(); $b->setStoreName("SortTest2")->setPopulationServed(201)->save(); $b = new Bookstore(); $b->setStoreName("SortTest3")->setPopulationServed(302)->save(); $b = new Bookstore(); $b->setStoreName("SortTest4")->setPopulationServed(10000000)->save(); $c = new Criteria(); $c->setIgnoreCase(true); $c->add(BookstorePeer::STORE_NAME, 'SortTest%', Criteria::LIKE); $c->addAscendingOrderByColumn(BookstorePeer::POPULATION_SERVED); $rows = BookstorePeer::doSelect($c); $this->assertEquals('SortTest2', $rows[0]->getStoreName()); $this->assertEquals('SortTest3', $rows[1]->getStoreName()); $this->assertEquals('SortTest1', $rows[2]->getStoreName()); $this->assertEquals('SortTest4', $rows[3]->getStoreName()); }
/** * Tests the overriding reloadOnUpdate at runtime. * * @link http://trac.propelorm.org/ticket/378 * @link http://trac.propelorm.org/ticket/555 */ public function testDefaultExpresions_ReloadOnUpdate_Override() { $b = new Bookstore(); $b->setStoreName("Foo!"); $b->save(); $sale = new BookstoreSale(); $sale->setBookstore(BookstorePeer::doSelectOne(new Criteria())); $sale->setSaleName("Spring Sale"); $sale->save(); // Expect that default values are set, but not default expressions $this->assertNull($sale->getDiscount(), "Expected discount to be NULL."); $sale->setSaleName("Winter Clearance"); $sale->save(null, $skipReload = true); // Since reloadOnUpdate = true, we expect the discount to be set now. $this->assertNull($sale->getDiscount(), "Expected NULL value for discount after save."); }
public function testDefaultFkColVal() { $sale = new BookstoreSale(); $this->assertEquals(1, $sale->getBookstoreId(), "Expected BookstoreSale object to have a default bookstore_id of 1."); $bookstore = BookstorePeer::doSelectOne(new Criteria()); $sale->setBookstore($bookstore); $this->assertEquals($bookstore->getId(), $sale->getBookstoreId(), "Expected FK id to have changed when assigned a valid FK."); $sale->setBookstore(null); $this->assertEquals(1, $sale->getBookstoreId(), "Expected BookstoreSale object to have reset to default ID."); $sale->setPublisher(null); $this->assertEquals(null, $sale->getPublisherId(), "Expected BookstoreSale object to have reset to NULL publisher ID."); }
public static function depopulate() { AcctAccessRolePeer::doDeleteAll(); AuthorPeer::doDeleteAll(); BookstorePeer::doDeleteAll(); BookstoreContestPeer::doDeleteAll(); BookstoreContestEntryPeer::doDeleteAll(); BookstoreEmployeePeer::doDeleteAll(); BookstoreEmployeeAccountPeer::doDeleteAll(); BookstoreSalePeer::doDeleteAll(); BookClubListPeer::doDeleteAll(); BookOpinionPeer::doDeleteAll(); BookReaderPeer::doDeleteAll(); BookListRelPeer::doDeleteAll(); BookPeer::doDeleteAll(); ContestPeer::doDeleteAll(); CustomerPeer::doDeleteAll(); MediaPeer::doDeleteAll(); PublisherPeer::doDeleteAll(); ReaderFavoritePeer::doDeleteAll(); ReviewPeer::doDeleteAll(); }
public static function depopulate($con = null) { if ($con === null) { $con = Propel::getConnection(BookPeer::DATABASE_NAME); } $con->beginTransaction(); AuthorPeer::doDeleteAll($con); BookstorePeer::doDeleteAll($con); BookstoreContestPeer::doDeleteAll($con); BookstoreContestEntryPeer::doDeleteAll($con); BookstoreEmployeePeer::doDeleteAll($con); BookstoreEmployeeAccountPeer::doDeleteAll($con); BookstoreSalePeer::doDeleteAll($con); BookClubListPeer::doDeleteAll($con); BookOpinionPeer::doDeleteAll($con); BookReaderPeer::doDeleteAll($con); BookListRelPeer::doDeleteAll($con); BookPeer::doDeleteAll($con); ContestPeer::doDeleteAll($con); CustomerPeer::doDeleteAll($con); MediaPeer::doDeleteAll($con); PublisherPeer::doDeleteAll($con); ReaderFavoritePeer::doDeleteAll($con); ReviewPeer::doDeleteAll($con); $con->commit(); }