Permalink
Browse files

Fix test suite (safe mode)

  • Loading branch information...
willdurand committed Sep 10, 2012
1 parent 9ce1af4 commit 09760d7dfa26dddc96eb9228c06a2f01f5ffb5a4
@@ -36,9 +36,10 @@ public function modifyTable()
{
if (!$this->getTable()->containsColumn($this->getParameter('slug_column'))) {
$this->getTable()->addColumn(array(
- 'name' => $this->getParameter('slug_column'),
- 'type' => 'VARCHAR',
- 'size' => 255
+ 'name' => $this->getParameter('slug_column'),
+ 'type' => 'VARCHAR',
+ 'size' => 255,
+ 'required' => false,
));
// add a unique to column
$unique = new Unique($this->getColumnForParameter('slug_column'));
@@ -22,7 +22,7 @@
<table name="table_with_scope">
<column name="id" required="true" primaryKey="true" autoIncrement="true" type="INTEGER" />
- <column name="scope" required="true" type="INTEGER" />
+ <column name="scope" type="INTEGER" required="false" />
<column name="title" type="VARCHAR" size="100" primaryString="true" />
<behavior name="sluggable">
<parameter name="scope_column" value="scope" />
@@ -48,6 +48,7 @@ public function testComputeWithSchema()
ContestBookstoreContestQuery::create()->deleteAll($this->con);
$store = new BookstoreSchemasBookstore();
+ $store->setStoreName('A Name');
$store->save($this->con);
$this->assertEquals(0, $store->computeTotalContestEntries($this->con), 'The compute method returns 0 for objects with no related objects');
@@ -45,7 +45,7 @@ public function testManyToMany_Dir1()
$book = new Book();
$book->setTitle( "Jungle Expedition Handbook" );
- $book->setISBN('TEST');
+ $book->setIsbn('TEST');
// No save ...
$this->assertEquals(0, count($list->getBookListRels()) );
@@ -79,7 +79,7 @@ public function testManyToMany_Dir2_Unsaved()
$book = new Book();
$book->setTitle( "Jungle Expedition Handbook" );
- $book->setISBN('TEST');
+ $book->setIsbn('TEST');
// No save (yet) ...
$this->assertEquals(0, count($list->getBookListRels()) );
@@ -113,7 +113,7 @@ public function testManyToMany_Dir2_Saved()
$book = new Book();
$book->setTitle( "Jungle Expedition Handbook" );
- $book->setISBN('TEST');
+ $book->setIsbn('TEST');
// No save (yet) ...
$this->assertEquals(0, count($list->getBookListRels()) );
@@ -206,7 +206,7 @@ public function testManyToManyAdd()
$book = new Book();
$book->setTitle( "Jungle Expedition Handbook" );
- $book->setISBN('TEST');
+ $book->setIsbn('TEST');
$list->addBook($book);
$this->assertEquals(1, $list->countBooks(), 'addCrossFk() sets the internal collection properly');
@@ -272,7 +272,7 @@ public function testClearRefFk()
{
BookstoreDataPopulator::populate();
$book = new Book();
- $book->setISBN("Foo-bar-baz");
+ $book->setIsbn("Foo-bar-baz");
$book->setTitle("The book title");
// No save ...
@@ -320,13 +320,13 @@ public function testModifiedObjectOverwrite()
$book = new Book();
$book->setTitle("A sample book");
- $book->setISBN("INITIAL ISBN");
+ $book->setIsbn("INITIAL ISBN");
$author->addBook($book);
$author->save();
- $book->setISBN("MODIFIED ISBN");
+ $book->setIsbn("MODIFIED ISBN");
$books = $author->getBooks();
$this->assertEquals(1, count($books), "Expected 1 book.");
@@ -505,6 +505,7 @@ public function testSetterCollectionSavesForeignObjects()
$book = new Book();
$book->setTitle('My Book');
+ $book->setIsbn('123452');
$book->save();
// Modify it but don't save it
@@ -517,6 +518,7 @@ public function testSetterCollectionSavesForeignObjects()
$book = BookQuery::create()->findPk($book->getPrimaryKey());
$bookClubList1 = new BookClubList();
+ $bookClubList1->setGroupLeader('Something');
$bookClubList1->setBooks($coll);
$bookClubList1->save();
@@ -542,11 +544,16 @@ public function testSetterCollectionWithNewObjects()
$coll = new PropelObjectCollection();
$coll->setModel('Book');
- $coll[] = new Book();
- $coll[] = new Book();
- $coll[] = new Book();
+ for ($i = 0; $i < 3; $i++) {
+ $b = new Book();
+ $b->setTitle('Title ' . $i);
+ $b->setIsbn('1245' . $i);
+
+ $coll[] = $b;
+ }
$bookClubList = new BookClubList();
+ $bookClubList->setGroupLeader('Something');
$bookClubList->setBooks($coll);
$bookClubList->save();
@@ -568,13 +575,15 @@ public function testSetterCollectionWithExistingObjects()
for ($i = 0; $i < 3; $i++) {
$b = new Book();
$b->setTitle('Book ' . $i);
+ $b->setIsbn('123445' . $i);
$b->save();
}
BookPeer::clearInstancePool();
$books = BookQuery::create()->find();
$bookClubList = new BookClubList();
+ $bookClubList->setGroupLeader('Something');
$bookClubList->setBooks($books);
$bookClubList->save();
@@ -597,6 +606,7 @@ public function testSetterCollectionWithEmptyCollection()
BookListRelQuery::create()->deleteAll();
$bookClubList = new BookClubList();
+ $bookClubList->setGroupLeader('Something');
$bookClubList->setBooks(new PropelObjectCollection());
$bookClubList->save();
@@ -618,10 +628,13 @@ public function testSetterCollectionReplacesOldObjectsByNewObjects()
foreach (array('foo', 'bar') as $title) {
$b = new Book();
$b->setTitle($title);
+ $b->setIsbn('12553');
+
$books[] = $b;
}
$bookClubList = new BookClubList();
+ $bookClubList->setGroupLeader('Something');
$bookClubList->setBooks($books);
$bookClubList->save();
@@ -633,6 +646,8 @@ public function testSetterCollectionReplacesOldObjectsByNewObjects()
foreach (array('bam', 'bom') as $title) {
$b = new Book();
$b->setTitle($title);
+ $b->setIsbn('1345');
+
$books[] = $b;
}
@@ -668,11 +683,13 @@ public function testSetterCollectionWithManyToManyModifiedByReferenceWithANewObj
$book = new Book();
$book->setTitle('foo');
+ $book->setIsbn('12345');
// The object is "new"
$this->assertTrue($book->isNew());
$bookClubList = new BookClubList();
+ $bookClubList->setGroupLeader('Something');
$books = $bookClubList->getBooks();
// Add the object by reference
$books[] = $book;
@@ -694,12 +711,14 @@ public function testSetterCollectionWithManyToManyModifiedByReferenceWithAnExist
$book = new Book();
$book->setTitle('foo');
+ $book->setIsbn('124');
$book->save();
// The object isn't "new"
$this->assertFalse($book->isNew());
$bookClubList = new BookClubList();
+ $bookClubList->setGroupLeader('Something');
$books = $bookClubList->getBooks();
// Add the object by reference
$books[] = $book;
@@ -723,7 +742,7 @@ public function testRemoveObjectFromCollection()
$book = new Book();
$book->setTitle( "Jungle Expedition Handbook" );
- $book->setISBN('TEST');
+ $book->setIsbn('TEST');
// No save ...
$this->assertCount(0, $book->getBookClubLists(), 'No BookClubList');
@@ -749,7 +768,7 @@ public function testRemoveObjectStoredInDBFromCollection()
$book = new Book();
$book->setTitle( "Jungle Expedition Handbook" );
- $book->setISBN('TEST');
+ $book->setIsbn('TEST');
$book->addBookClubList($list);
$book->addBookClubList($list2);
$book->save();
@@ -773,9 +792,11 @@ public function testRemoveObjectOneToMany()
$book = new Book();
$book->setTitle('Propel Book');
+ $book->setIsbn('14');
$book2 = new Book();
$book2->setTitle('Propel2 Book');
+ $book2->setIsbn('124');
$author = new Author();
$author->setFirstName('François');
@@ -825,6 +846,7 @@ public function testRemoveObjectOneToManyWithFkRequired()
$book = new Book();
$book->setTitle('Propel Book');
+ $book->setIsbn('1235');
$book->addBookSummary($bookSummary);
$book->addBookSummary($bookSummary2);
Oops, something went wrong.

0 comments on commit 09760d7

Please sign in to comment.