function test_find()
 {
     //Arrange
     $name = "Hello Kitty";
     $name2 = "Pokemon";
     $test_collection = new Collection($name);
     $test_collection->save();
     $test_collection2 = new Collection($name2);
     $test_collection2->save();
     //Act
     $result = Collection::find($test_collection2->getId());
     //Assert
     $this->assertEquals($test_collection2, $result);
 }
 function test_find()
 {
     //Arrange
     $thing = "Run the World";
     $thing2 = "20 20 Experience";
     $test_collection = new Collection($thing);
     $test_collection->save();
     $test_collection2 = new Collection($thing2);
     $test_collection2->save();
     //Act
     $id = $test_collection->getId();
     $result = Collection::find($id);
     //Assert
     $this->assertEquals($test_collection, $result);
 }
Example #3
0
 /**
  * Declares an association between this object and a Collection object.
  *
  * @param      Collection $v
  * @return     CollectionFile The current object (for fluent API support)
  * @throws     PropelException
  */
 public function setCollection(Collection $v = null)
 {
     if ($v === null) {
         $this->setCollectionId(NULL);
     } else {
         $this->setCollectionId($v->getId());
     }
     $this->aCollection = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the Collection object, it will not be re-added.
     if ($v !== null) {
         $v->addCollectionFile($this);
     }
     return $this;
 }
Example #4
0
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      Collection $value A Collection object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(Collection $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }
 function testFind()
 {
     //Arrange
     $collection_name = "Rad stuff";
     $test_collection = new Collection($collection_name);
     $test_collection->save();
     $test_collection_id = $test_collection->getId();
     $name = "Hello Kitty";
     $name2 = "Pokemon";
     $test_item = new Item($name, $test_collection_id);
     $test_item->save();
     $test_item2 = new Item($name2, $test_collection_id);
     $test_item2->save();
     //Act
     $result = Item::find($test_item2->getId());
     //Assert
     $this->assertEquals($test_item2, $result);
 }