Author: garak
Date: 2010-09-01 10:26:04 +0200 (Wed, 01 Sep 2010)
New Revision: 30799

Modified:
   plugins/sfAssetsLibraryPlugin/branches/1.3/config/schema.yml
   plugins/sfAssetsLibraryPlugin/branches/1.3/lib/form/sfAssetMoveForm.class.php
   plugins/sfAssetsLibraryPlugin/branches/1.3/lib/model/plugin/PluginsfAsset.php
   
plugins/sfAssetsLibraryPlugin/branches/1.3/lib/model/plugin/PluginsfAssetFolder.php
   
plugins/sfAssetsLibraryPlugin/branches/1.3/lib/model/plugin/PluginsfAssetFolderPeer.php
   
plugins/sfAssetsLibraryPlugin/branches/1.3/lib/model/plugin/PluginsfAssetPeer.php
   
plugins/sfAssetsLibraryPlugin/branches/1.3/modules/sfAsset/actions/actions.class.php
   
plugins/sfAssetsLibraryPlugin/branches/1.3/modules/sfAsset/lib/BasesfAssetActions.class.php
   plugins/sfAssetsLibraryPlugin/branches/1.3/test/prove.php
   
plugins/sfAssetsLibraryPlugin/branches/1.3/test/unit/sfAssetFolderPeerTest.php
   plugins/sfAssetsLibraryPlugin/branches/1.3/test/unit/sfAssetFolderTest.php
   plugins/sfAssetsLibraryPlugin/branches/1.3/test/unit/sfAssetPeerTest.php
   plugins/sfAssetsLibraryPlugin/branches/1.3/test/unit/sfAssetTest.php
   
plugins/sfAssetsLibraryPlugin/branches/1.3/test/unit/sfAssetsLibraryToolsTest.php
Log:
[sfAssetsLibraryPlugin] changed schema to get more friendly relation names


Modified: plugins/sfAssetsLibraryPlugin/branches/1.3/config/schema.yml
===================================================================
--- plugins/sfAssetsLibraryPlugin/branches/1.3/config/schema.yml        
2010-09-01 08:15:08 UTC (rev 30798)
+++ plugins/sfAssetsLibraryPlugin/branches/1.3/config/schema.yml        
2010-09-01 08:26:04 UTC (rev 30799)
@@ -18,7 +18,7 @@
   sfAsset:
     columns:
       id:          ~
-      folder_id:   { type: integer, foreignClass: sfAssetFolder, 
foreignReference: id, required: true, onDelete: CASCADE, onUpdate: CASCADE }
+      folder_id:   { type: integer, required: true, fkPhpName: Folder, 
fkRefPhpName: Asset, foreignClass: sfAssetFolder, foreignReference: id, 
onDelete: cascade, onUpdate: cascade }
       filename:    { type: varchar, required: true, primaryString: true }
       description: { type: longvarchar }
       author:      { type: varchar }

Modified: 
plugins/sfAssetsLibraryPlugin/branches/1.3/lib/form/sfAssetMoveForm.class.php
===================================================================
--- 
plugins/sfAssetsLibraryPlugin/branches/1.3/lib/form/sfAssetMoveForm.class.php   
    2010-09-01 08:15:08 UTC (rev 30798)
+++ 
plugins/sfAssetsLibraryPlugin/branches/1.3/lib/form/sfAssetMoveForm.class.php   
    2010-09-01 08:26:04 UTC (rev 30799)
@@ -17,7 +17,7 @@
 
     // add parent folder select
     $this->widgetSchema['parent_folder'] = new 
sfWidgetFormPropelChoice(array('model' => 'sfAssetFolder',
-                                                                              
'criteria' => 
sfAssetFolderPeer::getAllPathsButOneCriteria($this->getObject()->getsfAssetFolder())));
+                                                                              
'criteria' => 
sfAssetFolderPeer::getAllPathsButOneCriteria($this->getObject()->getFolder())));
     $this->validatorSchema['parent_folder'] = new 
sfValidatorPropelChoice(array('model' => 'sfAssetFolder',
                                                                                
 'column' => 'id',
                                                                                
 'required' => true));

Modified: 
plugins/sfAssetsLibraryPlugin/branches/1.3/lib/model/plugin/PluginsfAsset.php
===================================================================
--- 
plugins/sfAssetsLibraryPlugin/branches/1.3/lib/model/plugin/PluginsfAsset.php   
    2010-09-01 08:15:08 UTC (rev 30798)
+++ 
plugins/sfAssetsLibraryPlugin/branches/1.3/lib/model/plugin/PluginsfAsset.php   
    2010-09-01 08:26:04 UTC (rev 30799)
@@ -5,6 +5,7 @@
  *
  * @package sfAssetsLibraryPlugin
  * @author  Massimiliano Arione
+ * @version SVN: $Id$
  */
 class PluginsfAsset extends BasesfAsset
 {
@@ -15,7 +16,7 @@
    */
   public function getFolderPath()
   {
-    $folder = $this->getsfAssetFolder();
+    $folder = $this->getFolder();
     if (!$folder)
     {
       throw new Exception(sprintf('You must set define the folder for an asset 
prior to getting its path. Asset %d doesn\'t have a folder yet.', 
$this->getFilename()));
@@ -62,7 +63,7 @@
   {
     if (is_null($relative_path))
     {
-      if (!$folder = $this->getsfAssetFolder())
+      if (!$folder = $this->getFolder())
       {
         throw new Exception(sprintf('You must set define the folder for an 
asset prior to getting its path. Asset %d doesn\'t have a folder yet.', 
$this->getFilename()));
       }
@@ -117,12 +118,12 @@
     }
 
     // check folder
-    if (!$this->getsfAssetFolder()->exists())
+    if (!$this->getFolder()->exists())
     {
-      $this->getsfAssetFolder()->create();
+      $this->getFolder()->create();
     }
     // check if a file with this name already exists
-    elseif ($checkDuplicate && 
sfAssetPeer::exists($this->getsfAssetFolder()->getId(), $this->getFilename()))
+    elseif ($checkDuplicate && 
sfAssetPeer::exists($this->getFolder()->getId(), $this->getFilename()))
     {
       $this->setFilename(time() . $this->getFilename());
     }


Property changes on: 
plugins/sfAssetsLibraryPlugin/branches/1.3/lib/model/plugin/PluginsfAsset.php
___________________________________________________________________
Added: svn:keywords
   + Id

Modified: 
plugins/sfAssetsLibraryPlugin/branches/1.3/lib/model/plugin/PluginsfAssetFolder.php
===================================================================
--- 
plugins/sfAssetsLibraryPlugin/branches/1.3/lib/model/plugin/PluginsfAssetFolder.php
 2010-09-01 08:15:08 UTC (rev 30798)
+++ 
plugins/sfAssetsLibraryPlugin/branches/1.3/lib/model/plugin/PluginsfAssetFolder.php
 2010-09-01 08:26:04 UTC (rev 30799)
@@ -5,6 +5,7 @@
  *
  * @package sfAssetsLibraryPlugin
  * @author  Massimiliano Arione
+ * @version SVN: $Id$
  */
 class PluginsfAssetFolder extends BasesfAssetFolderNestedSet
 {
@@ -358,7 +359,7 @@
       $success = $descendant->delete($con, $force) && $success;
     }
 
-    foreach ($this->getsfAssets() as $asset)
+    foreach ($this->getAssets() as $asset)
     {
       $success = $asset->delete() && $success;
     }


Property changes on: 
plugins/sfAssetsLibraryPlugin/branches/1.3/lib/model/plugin/PluginsfAssetFolder.php
___________________________________________________________________
Added: svn:keywords
   + Id

Modified: 
plugins/sfAssetsLibraryPlugin/branches/1.3/lib/model/plugin/PluginsfAssetFolderPeer.php
===================================================================
--- 
plugins/sfAssetsLibraryPlugin/branches/1.3/lib/model/plugin/PluginsfAssetFolderPeer.php
     2010-09-01 08:15:08 UTC (rev 30798)
+++ 
plugins/sfAssetsLibraryPlugin/branches/1.3/lib/model/plugin/PluginsfAssetFolderPeer.php
     2010-09-01 08:26:04 UTC (rev 30799)
@@ -5,6 +5,7 @@
  *
  * @package sfAssetsLibraryPlugin
  * @author  Massimiliano Arione
+ * @version SVN: $Id$
  */
 class PluginsfAssetFolderPeer extends BasesfAssetFolderNestedSetPeer
 {


Property changes on: 
plugins/sfAssetsLibraryPlugin/branches/1.3/lib/model/plugin/PluginsfAssetFolderPeer.php
___________________________________________________________________
Added: svn:keywords
   + Id

Modified: 
plugins/sfAssetsLibraryPlugin/branches/1.3/lib/model/plugin/PluginsfAssetPeer.php
===================================================================
--- 
plugins/sfAssetsLibraryPlugin/branches/1.3/lib/model/plugin/PluginsfAssetPeer.php
   2010-09-01 08:15:08 UTC (rev 30798)
+++ 
plugins/sfAssetsLibraryPlugin/branches/1.3/lib/model/plugin/PluginsfAssetPeer.php
   2010-09-01 08:26:04 UTC (rev 30799)
@@ -5,6 +5,7 @@
  *
  * @package sfAssetsLibraryPlugin
  * @author  Massimiliano Arione
+ * @version SVN: $Id$
  */
 class PluginsfAssetPeer extends BasesfAssetPeer
 {
@@ -56,7 +57,7 @@
     $pager = new sfPropelPager('sfAsset', $size);
     $pager->setCriteria($c);
     $pager->setPage($page);
-    $pager->setPeerMethod('doSelectJoinsfAssetFolder');
+    $pager->setPeerMethod('doSelectJoinFolder');
     $pager->init();
 
     return $pager;


Property changes on: 
plugins/sfAssetsLibraryPlugin/branches/1.3/lib/model/plugin/PluginsfAssetPeer.php
___________________________________________________________________
Added: svn:keywords
   + Id

Modified: 
plugins/sfAssetsLibraryPlugin/branches/1.3/modules/sfAsset/actions/actions.class.php
===================================================================
--- 
plugins/sfAssetsLibraryPlugin/branches/1.3/modules/sfAsset/actions/actions.class.php
        2010-09-01 08:15:08 UTC (rev 30798)
+++ 
plugins/sfAssetsLibraryPlugin/branches/1.3/modules/sfAsset/actions/actions.class.php
        2010-09-01 08:26:04 UTC (rev 30799)
@@ -1,6 +1,6 @@
 <?php
 
-require_once(sfConfig::get('sf_plugins_dir'). 
'/sfAssetsLibraryPlugin/modules/sfAsset/lib/BasesfAssetActions.class.php');
+require_once sfConfig::get('sf_plugins_dir'). 
'/sfAssetsLibraryPlugin/modules/sfAsset/lib/BasesfAssetActions.class.php';
 
 class sfAssetActions extends BasesfAssetActions
 {

Modified: 
plugins/sfAssetsLibraryPlugin/branches/1.3/modules/sfAsset/lib/BasesfAssetActions.class.php
===================================================================
--- 
plugins/sfAssetsLibraryPlugin/branches/1.3/modules/sfAsset/lib/BasesfAssetActions.class.php
 2010-09-01 08:15:08 UTC (rev 30798)
+++ 
plugins/sfAssetsLibraryPlugin/branches/1.3/modules/sfAsset/lib/BasesfAssetActions.class.php
 2010-09-01 08:26:04 UTC (rev 30799)
@@ -398,7 +398,7 @@
     {
       try
       {
-        $asset->move($asset->getsfAssetFolder(), 
$this->form->getValue('filename'));
+        $asset->move($asset->getFolder(), $this->form->getValue('filename'));
         $asset->save();
         $this->dispatcher->notify(new sfEvent($this, 'admin.save_object', 
array('object' => $asset)));
         $this->getUser()->setFlash('notice', 'The file has been renamed');
@@ -511,25 +511,4 @@
       $this->popup = false;
     }
   }
-
-  /**
-   * @param  sfWebRequest $request
-   * @param  string
-   * @return sfAsset
-   */
-  protected function getsfAssetOrCreate(sfWebRequest $request, $id = 'id')
-  {
-    if (!$request->getParameter($id))
-    {
-      $asset = new sfAsset();
-    }
-    else
-    {
-      $asset = sfAssetPeer::retrieveByPk($request->getParameter($id));
-      $this->forward404Unless($asset, 'asset not found');
-    }
-
-    return $asset;
-  }
-
 }

Modified: plugins/sfAssetsLibraryPlugin/branches/1.3/test/prove.php
===================================================================
--- plugins/sfAssetsLibraryPlugin/branches/1.3/test/prove.php   2010-09-01 
08:15:08 UTC (rev 30798)
+++ plugins/sfAssetsLibraryPlugin/branches/1.3/test/prove.php   2010-09-01 
08:26:04 UTC (rev 30799)
@@ -1,9 +1,9 @@
 <?php
 /*
  * This file is part of the sfPropelFinder package.
- * 
+ *
  * (c) 2007 François Zaninotto <[email protected]>
- * 
+ *
  * For the full copyright and license information, please view the LICENSE
  * file that was distributed with this source code.
  */
@@ -11,8 +11,8 @@
 // Autofind the first available app environment
 $sf_root_dir = realpath(dirname(__FILE__).'/../../../');
 $apps_dir = glob($sf_root_dir.'/apps/*', GLOB_ONLYDIR);
-$app = substr($apps_dir[0], 
-              strrpos($apps_dir[0], DIRECTORY_SEPARATOR) + 1, 
+$app = substr($apps_dir[0],
+              strrpos($apps_dir[0], DIRECTORY_SEPARATOR) + 1,
               strlen($apps_dir[0]));
 if (!$app)
 {
@@ -23,8 +23,8 @@
 $sf_path = dirname(__FILE__).'/../../..';
 
 // bootstrap
-include($sf_path . '/test/bootstrap/functional.php');
-require_once(sfConfig::get('sf_symfony_lib_dir').'/vendor/lime/lime.php'); 
+include $sf_path . '/test/bootstrap/functional.php';
+require_once sfConfig::get('sf_symfony_lib_dir').'/vendor/lime/lime.php';
 
 $h = new lime_harness(new lime_output_color());
 $h->base_dir = dirname(__FILE__);

Modified: 
plugins/sfAssetsLibraryPlugin/branches/1.3/test/unit/sfAssetFolderPeerTest.php
===================================================================
--- 
plugins/sfAssetsLibraryPlugin/branches/1.3/test/unit/sfAssetFolderPeerTest.php  
    2010-09-01 08:15:08 UTC (rev 30798)
+++ 
plugins/sfAssetsLibraryPlugin/branches/1.3/test/unit/sfAssetFolderPeerTest.php  
    2010-09-01 08:26:04 UTC (rev 30799)
@@ -1,8 +1,8 @@
 <?php
 
-$app = "frontend";
-include(dirname(__FILE__).'/../../../../test/bootstrap/functional.php');
-include($configuration->getSymfonyLibDir().'/vendor/lime/lime.php');
+$app = 'frontend';
+include dirname(__FILE__).'/../../../../test/bootstrap/functional.php';
+include $configuration->getSymfonyLibDir().'/vendor/lime/lime.php';
 $databaseManager = new sfDatabaseManager($configuration);
 $con = Propel::getConnection();
 
@@ -17,17 +17,17 @@
   $f->setName(sfConfig::get('app_sfAssetsLibrary_upload_dir'));
   sfAssetFolderPeer::createRoot($f);
   $f->save();
-  
+
   // run the test
   $t = new lime_test(13, new lime_output_color());
   $t->diag('sfAssetFolderPeer');
-  
+
   $sfAssetFolder = 
sfAssetFolderPeer::retrieveByPath(sfConfig::get('app_sfAssetsLibrary_upload_dir',
 'media'));
   $t->ok($sfAssetFolder->isRoot(), 'retrieveByPath() retrieves root from 
app_sfAssetsLibrary_upload_dir string');
 
   $sfAssetFolder = sfAssetFolderPeer::retrieveByPath();
   $t->ok($sfAssetFolder->isRoot(), 'retrieveByPath() retrieves root from empty 
string');
-  
+
   $sfAssetFolder = 
sfAssetFolderPeer::createFromPath(sfConfig::get('app_sfAssetsLibrary_upload_dir',
 'media').'/simple');
   $t->isa_ok($sfAssetFolder, 'sfAssetFolder', 'createFromPath() creates a 
sfAssetFolder from simple string');
   $t->isa_ok($sfAssetFolder->retrieveParent(), 'sfAssetFolder', 
'createFromPath() from simple string has a parent');
@@ -41,7 +41,7 @@
   $t->ok($sfAssetFolder instanceof sfAssetFolder, 'createFromPath() creates a 
sfAssetFolder from simple string');
   $t->ok($sfAssetFolder->retrieveParent() instanceof sfAssetFolder, 
'createFromPath() from composed string has a parent');
   $t->ok($sfAssetFolder->retrieveParent()->retrieveParent()->isRoot(), 
'createFromPath() creates a root child from composed string');
-  
+
   $sfAssetFolder = sfAssetFolderPeer::createFromPath('third/subfolder');
   $t->ok($sfAssetFolder instanceof sfAssetFolder, 'createFromPath() creates a 
sfAssetFolder from simple string');
   $t->ok($sfAssetFolder->retrieveParent() instanceof sfAssetFolder, 
'createFromPath() from composed string has a parent');
@@ -54,4 +54,3 @@
 
 // reset DB
 $con->rollBack();
-

Modified: 
plugins/sfAssetsLibraryPlugin/branches/1.3/test/unit/sfAssetFolderTest.php
===================================================================
--- plugins/sfAssetsLibraryPlugin/branches/1.3/test/unit/sfAssetFolderTest.php  
2010-09-01 08:15:08 UTC (rev 30798)
+++ plugins/sfAssetsLibraryPlugin/branches/1.3/test/unit/sfAssetFolderTest.php  
2010-09-01 08:26:04 UTC (rev 30799)
@@ -1,8 +1,8 @@
 <?php
 
-$app = "frontend";
-include(dirname(__FILE__).'/../../../../test/bootstrap/functional.php');
-include($configuration->getSymfonyLibDir().'/vendor/lime/lime.php');
+$app = 'frontend';
+include dirname(__FILE__).'/../../../../test/bootstrap/functional.php';
+include $configuration->getSymfonyLibDir().'/vendor/lime/lime.php';
 $databaseManager = new sfDatabaseManager($configuration);
 $con = Propel::getConnection();
 
@@ -18,22 +18,22 @@
   sfAssetFolderPeer::createRoot($root);
   $root->save();
   $rootId = $root->getId();
-    
+
   // run the test
   $t = new lime_test(10, new lime_output_color());
-  
+
   $t->diag('sfAssetFolder::getName()');
-  
+
   # $sfAssetFolder is /root/Test_Directory
   $sfAssetFolder = new sfAssetFolder();
   $sfAssetFolder->setName('Test_Directory');
   $sfAssetFolder->insertAsFirstChildOf($root);
   $sfAssetFolder->save();
   $t->is($sfAssetFolder->getName(), 'Test_Directory', 'getName() returns the 
folder name');
-  
+
   $t->diag('sfAssetFolder::getRelativePath()');
   $t->is($sfAssetFolder->getRelativePath(), $root->getRelativePath() . '/' . 
$sfAssetFolder->getName(), 'getRelativePath() returns the folder relative path, 
including its own name');
-  
+
   # $sfAssetFolder2 is /root/Test_Directory/Test_Sub-directory
   $sfAssetFolder2 = new sfAssetFolder();
   $sfAssetFolder2->setName('Test_Sub-directory');
@@ -49,24 +49,24 @@
   $sfAssetFolder3->save();
   $t->is($sfAssetFolder3->getRelativePath(), 
$sfAssetFolder2->getRelativePath() . '/' . $sfAssetFolder3->getName(), 
'getRelativePath() returns the folder relative path, including its ancestors 
names');
   $id3 = $sfAssetFolder3->getId();
-  
+
   # $sfAsset is /root/Test_Directory/Test_Sub-directory/raikkonen.jpg
   $assets_path = dirname(__FILE__).'/../assets/';
   $test_asset = $assets_path . 'raikkonen.jpg';
   $sfAsset = new sfAsset();
-  $sfAsset->setsfAssetFolder($sfAssetFolder2);
+  $sfAsset->setFolder($sfAssetFolder2);
   $sfAsset->create($test_asset, false);
   $sfAsset->save();
   $sf_asset_id = $sfAsset->getId();
-  
+
   # $sfAsset2 is 
/root/Test_Directory/Test_Sub-directory/Test_Sub-sub-directory/toto
   $sfAsset2 = new sfAsset();
-  $sfAsset2->setsfAssetFolder($sfAssetFolder3);
+  $sfAsset2->setFolder($sfAssetFolder3);
   $sfAsset2->setFilename('toto');
   $sfAsset2->create($test_asset, false);
   $sfAsset2->save();
   $sf_asset2_id = $sfAsset2->getId();
-  
+
   # So now we have:
   # root/
   #   Test_Directory/               sfAssetFolder
@@ -74,13 +74,13 @@
   #       Test_Sub-sub-directory/   sfAssetFolder3
   #         toto
   #       raikkonen.jpg
-  
+
   $t->diag('sfAssetFolder::move()');
-  
-  # move $sfAssetFolder2 from /root/Test_Directory/Test_Sub-directory to 
/root/Test_Sub-directory  
+
+  # move $sfAssetFolder2 from /root/Test_Directory/Test_Sub-directory to 
/root/Test_Sub-directory
   $sfAssetFolder2->move($root);
   $sfAssetFolder2->save();
-  
+
   # So now we have:
   # root/
   #   Test_Directory/             sfAssetFolder
@@ -94,12 +94,12 @@
   $root = sfAssetFolderPeer::retrieveByPk($rootId);
   $sfAssetFolder2 = sfAssetFolderPeer::retrieveByPk($id2);
   $sfAssetFolder3 = sfAssetFolderPeer::retrieveByPk($id3);
-  
+
   $t->is($sfAssetFolder2->retrieveParent()->getId(), $root->getId(), 'move() 
gives the correct parent');
   $t->is($sfAssetFolder3->retrieveParent()->retrieveParent()->getId(), 
$root->getId(), 'move() also moves children');
   $t->is($sfAssetFolder2->getRelativePath(), $root->getRelativePath() . '/' . 
$sfAssetFolder2->getName(), 'move() changes descendants relative paths');
   $t->is($sfAssetFolder3->getRelativePath(), 
$sfAssetFolder2->getRelativePath() . '/' . $sfAssetFolder3->getName(), 'move() 
changes descendants relative paths');
-  
+
   sfAssetPeer::clearInstancePool();
   $sfAsset = sfAssetPeer::retrieveByPk($sf_asset_id);
   $sfAsset2 = sfAssetPeer::retrieveByPk($sf_asset2_id);

Modified: 
plugins/sfAssetsLibraryPlugin/branches/1.3/test/unit/sfAssetPeerTest.php
===================================================================
--- plugins/sfAssetsLibraryPlugin/branches/1.3/test/unit/sfAssetPeerTest.php    
2010-09-01 08:15:08 UTC (rev 30798)
+++ plugins/sfAssetsLibraryPlugin/branches/1.3/test/unit/sfAssetPeerTest.php    
2010-09-01 08:26:04 UTC (rev 30799)
@@ -1,8 +1,8 @@
 <?php
 
-$app = "frontend";
-include(dirname(__FILE__).'/../../../../test/bootstrap/functional.php');
-include($configuration->getSymfonyLibDir().'/vendor/lime/lime.php');
+$app = 'frontend';
+include dirname(__FILE__).'/../../../../test/bootstrap/functional.php';
+include $configuration->getSymfonyLibDir().'/vendor/lime/lime.php';
 $databaseManager = new sfDatabaseManager($configuration);
 $con = Propel::getConnection();
 
@@ -17,15 +17,15 @@
   $f->setName(sfConfig::get('app_sfAssetsLibrary_upload_dir'));
   sfAssetFolderPeer::createRoot($f);
   $f->save();
-  
+
   $t = new lime_test(5, new lime_output_color());
   $t->diag('sfAssetPeer');
 
   
$t->is(sfAssetPeer::retrieveFromUrl(sfAssetFolderPeer::retrieveRoot()->getRelativePath()
 . '/filename.jpg'), null, 'sfAssetPeer::retrieveFromUrl() returns null when a 
URL is not found');
   $t->is(sfAssetPeer::exists(sfAssetFolderPeer::retrieveRoot()->getId(), 
'filename.jpg'), false, 'sfAssetPeer::exists() returns false when an asset is 
not found');
-  
+
   $sfAsset = new sfAsset();
-  $sfAsset->setsfAssetFolder(sfAssetFolderPeer::retrieveRoot());
+  $sfAsset->setFolder(sfAssetFolderPeer::retrieveRoot());
   $sfAsset->setFilename('filename.jpg');
   $sfAsset->save($con);
   
$t->is(sfAssetPeer::retrieveFromUrl(sfAssetFolderPeer::retrieveRoot()->getRelativePath()
 . '/filename.jpg')->getId(), $sfAsset->getId(), 
'sfAssetPeer::retrieveFromUrl() finds an asset from its URL');

Modified: plugins/sfAssetsLibraryPlugin/branches/1.3/test/unit/sfAssetTest.php
===================================================================
--- plugins/sfAssetsLibraryPlugin/branches/1.3/test/unit/sfAssetTest.php        
2010-09-01 08:15:08 UTC (rev 30798)
+++ plugins/sfAssetsLibraryPlugin/branches/1.3/test/unit/sfAssetTest.php        
2010-09-01 08:26:04 UTC (rev 30799)
@@ -1,8 +1,8 @@
 <?php
 
-$app = "frontend";
-include(dirname(__FILE__).'/../../../../test/bootstrap/functional.php');
-include($configuration->getSymfonyLibDir().'/vendor/lime/lime.php');
+$app = 'frontend';
+include dirname(__FILE__).'/../../../../test/bootstrap/functional.php';
+include $configuration->getSymfonyLibDir().'/vendor/lime/lime.php';
 $databaseManager = new sfDatabaseManager($configuration);
 $con = Propel::getConnection();
 
@@ -24,23 +24,23 @@
   $t->diag('sfAsset');
 
   $sfAsset = new sfAsset();
-  $sfAsset->setsfAssetFolder($root);
-  $t->isa_ok($sfAsset->getsfAssetFolder(), 'sfAssetFolder', 'sfAsset can have 
root as folder');
+  $sfAsset->setFolder($root);
+  $t->isa_ok($sfAsset->getFolder(), 'sfAssetFolder', 'sfAsset can have root as 
folder');
   $sfAsset->setFilename('filename.jpg');
-  
+
   $t->diag('sfAsset::getRelativePath()');
   $t->is($sfAsset->getRelativePath(), 
sfConfig::get('app_sfAssetsLibrary_upload_dir') .  DIRECTORY_SEPARATOR . 
'filename.jpg', 'getRelativePath() returns the path relative to the media 
directory');
 
   $t->diag('sfAsset::getFullPath()');
-  $t->is($sfAsset->getFullPath(), sfConfig::get('sf_web_dir'). 
DIRECTORY_SEPARATOR . sfConfig::get('app_sfAssetsLibrary_upload_dir') . 
DIRECTORY_SEPARATOR .'filename.jpg', 'getFullPath() returns the complete asset 
path on the disk'); 
-  $t->is($sfAsset->getFullPath('small'), sfConfig::get('sf_web_dir'). 
DIRECTORY_SEPARATOR . sfConfig::get('app_sfAssetsLibrary_upload_dir') 
.DIRECTORY_SEPARATOR .'thumbnail/small_filename.jpg', 'getFullPath(\'small\') 
returns the complete small thumbnail path on the disk'); 
-  $t->is($sfAsset->getFullPath('large'), sfConfig::get('sf_web_dir'). 
DIRECTORY_SEPARATOR . sfConfig::get('app_sfAssetsLibrary_upload_dir') 
.DIRECTORY_SEPARATOR .'thumbnail/large_filename.jpg', 'getFullPath(\'large\') 
returns the complete large thumbnail path on the disk'); 
-  
+  $t->is($sfAsset->getFullPath(), sfConfig::get('sf_web_dir'). 
DIRECTORY_SEPARATOR . sfConfig::get('app_sfAssetsLibrary_upload_dir') . 
DIRECTORY_SEPARATOR .'filename.jpg', 'getFullPath() returns the complete asset 
path on the disk');
+  $t->is($sfAsset->getFullPath('small'), sfConfig::get('sf_web_dir'). 
DIRECTORY_SEPARATOR . sfConfig::get('app_sfAssetsLibrary_upload_dir') 
.DIRECTORY_SEPARATOR .'thumbnail/small_filename.jpg', 'getFullPath(\'small\') 
returns the complete small thumbnail path on the disk');
+  $t->is($sfAsset->getFullPath('large'), sfConfig::get('sf_web_dir'). 
DIRECTORY_SEPARATOR . sfConfig::get('app_sfAssetsLibrary_upload_dir') 
.DIRECTORY_SEPARATOR .'thumbnail/large_filename.jpg', 'getFullPath(\'large\') 
returns the complete large thumbnail path on the disk');
+
   $t->diag('sfAsset::getUrl()');
   $t->is($sfAsset->getUrl(), DIRECTORY_SEPARATOR . 
sfConfig::get('app_sfAssetsLibrary_upload_dir') .DIRECTORY_SEPARATOR . 
'filename.jpg', 'getUrl() returns the asset URL');
   $t->is($sfAsset->getUrl('small'),DIRECTORY_SEPARATOR . 
sfConfig::get('app_sfAssetsLibrary_upload_dir') .DIRECTORY_SEPARATOR 
.'thumbnail/small_filename.jpg', 'getUrl(\'small\') returns the small thumbnail 
url');
   $t->is($sfAsset->getUrl('large'),DIRECTORY_SEPARATOR . 
sfConfig::get('app_sfAssetsLibrary_upload_dir') .DIRECTORY_SEPARATOR 
.'thumbnail/large_filename.jpg', 'getUrl(\'large\') returns the large thumbnail 
url');
-  
+
   $t->diag('sfAsset::create()');
   $assets_path = dirname(__FILE__).'/../assets/';
   $test_asset = $assets_path . 'raikkonen.jpg';
@@ -48,9 +48,9 @@
   $folder1->insertAsFirstChildOf($root);
   $folder1->setName('Test_Directory');
   $folder1->save();
-  
+
   $asset1 = new sfAsset();
-  $asset1->setsfAssetFolder($folder1);
+  $asset1->setFolder($folder1);
   $asset1->create($test_asset, false);
 
   $t->is($asset1->getFilename(), 'raikkonen.jpg', 'create() sets the object 
filename according to the given asset');
@@ -59,7 +59,7 @@
   $t->is($asset1->getUrl(), $folder1->getUrl() . DIRECTORY_SEPARATOR . 
$asset1->getFilename(), 'create() sets the object url according to the given 
asset and folder object');
   $t->ok(is_file($asset1->getFullPath()), 'create() physically copies asset');
   $t->ok(is_file($asset1->getFullPath('large')), 'create() physically creates 
thumbnail');
-  
+
   $t->diag('sfAsset::move()');
   $old_path = $asset1->getFullPath();
   $old_thumb_path = $asset1->getFullPath('large');
@@ -70,7 +70,7 @@
   $t->ok(!is_file($old_path), 'move() physically removes asset from the 
previous location');
   $t->ok(is_file($asset1->getFullPath('large')), 'move() physically moves 
thumbnail to the new location');
   $t->ok(!is_file($old_thumb_path), 'move() physically removes thumbnail from 
the previous location');
-  
+
   $t->diag('sfAsset::delete()');
   $old_path = $asset1->getFullPath();
   $old_thumb_path = $asset1->getFullPath('large');
@@ -88,4 +88,3 @@
 
 // reset DB
 $con->rollBack();
-

Modified: 
plugins/sfAssetsLibraryPlugin/branches/1.3/test/unit/sfAssetsLibraryToolsTest.php
===================================================================
--- 
plugins/sfAssetsLibraryPlugin/branches/1.3/test/unit/sfAssetsLibraryToolsTest.php
   2010-09-01 08:15:08 UTC (rev 30798)
+++ 
plugins/sfAssetsLibraryPlugin/branches/1.3/test/unit/sfAssetsLibraryToolsTest.php
   2010-09-01 08:26:04 UTC (rev 30799)
@@ -3,9 +3,9 @@
  * @author MaGénération
  */
 
-include(dirname(__FILE__).'/../../../../test/bootstrap/unit.php');
+include dirname(__FILE__).'/../../../../test/bootstrap/unit.php';
 $pluginPaths = $configuration->getAllPluginPaths();
-include($pluginPaths['sfAssetsLibraryPlugin'] . 
'/lib/sfAssetsLibraryTools.class.php');
+include $pluginPaths['sfAssetsLibraryPlugin'] . 
'/lib/sfAssetsLibraryTools.class.php';
 
 // run the test
 $t = new lime_test(5, new lime_output_color());

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.

Reply via email to