Example #1
0
 /**
  * Tests the overriding reloadOnUpdate at runtime.
  *
  * @link       http://propel.phpdb.org/trac/ticket/378
  * @link       http://propel.phpdb.org/trac/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()
 {
     BookstoreDataPopulator::populate();
     $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.");
 }
Example #3
0
 public function testBigIntIgnoreCaseOrderBy()
 {
     BookstorePeer::doDeleteAll();
     // 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());
 }