public function testAddSelectColumnsAliasLazyLoad()
 {
     $c = new Criteria();
     MediaTableMap::addSelectColumns($c, 'bar');
     $expected = array('bar.ID', 'bar.BOOK_ID');
     $this->assertEquals($expected, $c->getSelectColumns(), 'addSelectColumns() does not add lazy loaded columns but uses the second parameter as an alias');
 }
 public function testLobSetting_WriteMode()
 {
     $blob_path = $this->getLobFile('tin_drum.gif');
     $blob2_path = $this->getLobFile('propel.gif');
     $clob_path = $this->getLobFile('tin_drum.txt');
     $book = BookQuery::create()->findOne();
     $m1 = new Media();
     $m1->setBook($book);
     $m1->setCoverImage(file_get_contents($blob_path));
     $m1->setExcerpt(file_get_contents($clob_path));
     $m1->save();
     MediaTableMap::clearInstancePool();
     // make sure we have the latest from the db:
     $m2 = MediaQuery::create()->findPk($m1->getId());
     // now attempt to assign a temporary stream, opened in 'w' mode, to the db
     $stream = fopen("php://memory", 'w');
     fwrite($stream, file_get_contents($blob2_path));
     $m2->setCoverImage($stream);
     $m2->save();
     fclose($stream);
     $m2->reload();
     $this->assertEquals(md5(file_get_contents($blob2_path)), md5(stream_get_contents($m2->getCoverImage())), "Expected contents to match when setting stream w/ 'w' mode");
     $stream2 = fopen("php://memory", 'w+');
     fwrite($stream2, file_get_contents($blob_path));
     rewind($stream2);
     $this->assertEquals(md5(file_get_contents($blob_path)), md5(stream_get_contents($stream2)), "Expecting setup to be correct");
     $m2->setCoverImage($stream2);
     $m2->save();
     $m2->reload();
     $this->assertEquals(md5(file_get_contents($blob_path)), md5(stream_get_contents($m2->getCoverImage())), "Expected contents to match when setting stream w/ 'w+' mode");
 }