Author: caefer
Date: 2010-03-23 21:31:35 +0100 (Tue, 23 Mar 2010)
New Revision: 28738

Added:
   plugins/sfImageTransformExtraPlugin/trunk/test/fixtures/model/
   plugins/sfImageTransformExtraPlugin/trunk/test/fixtures/model/TestRecord.php
Removed:
   plugins/sfImageTransformExtraPlugin/trunk/test/bootstrap/TestRecord.php
Modified:
   
plugins/sfImageTransformExtraPlugin/trunk/test/unit/lib/routing/sfImageTransformRouteTest.php
   
plugins/sfImageTransformExtraPlugin/trunk/test/unit/lib/source/sfImageSourceDoctrineTest.php
   
plugins/sfImageTransformExtraPlugin/trunk/test/unit/lib/source/sfImageSourcePropelTest.php
Log:

 * moved TestRecord to fixtures
 * more coverage of sfImageTransformRoute


Deleted: plugins/sfImageTransformExtraPlugin/trunk/test/bootstrap/TestRecord.php
===================================================================
--- plugins/sfImageTransformExtraPlugin/trunk/test/bootstrap/TestRecord.php     
2010-03-23 19:43:25 UTC (rev 28737)
+++ plugins/sfImageTransformExtraPlugin/trunk/test/bootstrap/TestRecord.php     
2010-03-23 20:31:35 UTC (rev 28738)
@@ -1,47 +0,0 @@
-<?php
-/**
- * This file is part of the sfImageTransformExtraPlugin unit tests package.
- * (c) 2010 Christian Schaefer <[email protected]>>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- *
- * @package    sfImageTransformExtraPluginUnitTests
- * @author     Christian Schaefer <[email protected]>
- * @version    SVN: $Id: sfRawFileCache.class.php 63 2010-03-09 04:34:28Z 
caefer $
- */
-
-/**
- * Mocked Doctrine record to use in tests
- *
- * @package    sfImageTransformExtraPluginUnitTests
- * @subpackage Record
- * @author     Christian Schaefer <[email protected]>
- */
-class TestRecord extends Doctrine_Record
-{
-  public function getTestAttribute()
-  {
-    return 'test-me';
-  }
-
-  public function getFile()
-  {
-    return '/testrecord/daphne.jpg';
-  }
-}
-
-/**
- * Mocked Doctrine table to use in tests
- *
- * @package    sfImageTransformExtraPluginUnitTests
- * @subpackage Table
- * @author     Christian Schaefer <[email protected]>
- */
-class TestRecordTable extends Doctrine_Table
-{
-  public function find($id)
-  {
-    return new TestRecord();
-  }
-}

Copied: 
plugins/sfImageTransformExtraPlugin/trunk/test/fixtures/model/TestRecord.php 
(from rev 28670, 
plugins/sfImageTransformExtraPlugin/trunk/test/bootstrap/TestRecord.php)
===================================================================
--- 
plugins/sfImageTransformExtraPlugin/trunk/test/fixtures/model/TestRecord.php    
                            (rev 0)
+++ 
plugins/sfImageTransformExtraPlugin/trunk/test/fixtures/model/TestRecord.php    
    2010-03-23 20:31:35 UTC (rev 28738)
@@ -0,0 +1,52 @@
+<?php
+/**
+ * This file is part of the sfImageTransformExtraPlugin unit tests package.
+ * (c) 2010 Christian Schaefer <[email protected]>>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ *
+ * @package    sfImageTransformExtraPluginUnitTests
+ * @author     Christian Schaefer <[email protected]>
+ * @version    SVN: $Id: sfRawFileCache.class.php 63 2010-03-09 04:34:28Z 
caefer $
+ */
+
+/**
+ * Mocked Doctrine record to use in tests
+ *
+ * @package    sfImageTransformExtraPluginUnitTests
+ * @subpackage Record
+ * @author     Christian Schaefer <[email protected]>
+ */
+class TestRecord extends Doctrine_Record
+{
+  public function getTestAttribute()
+  {
+    return 'test-me';
+  }
+
+  public function getId()
+  {
+    return 1;
+  }
+
+  public function getFile()
+  {
+    return '/testrecord/daphne.jpg';
+  }
+}
+
+/**
+ * Mocked Doctrine table to use in tests
+ *
+ * @package    sfImageTransformExtraPluginUnitTests
+ * @subpackage Table
+ * @author     Christian Schaefer <[email protected]>
+ */
+class TestRecordTable extends Doctrine_Table
+{
+  public function find($id)
+  {
+    return new TestRecord();
+  }
+}

Modified: 
plugins/sfImageTransformExtraPlugin/trunk/test/unit/lib/routing/sfImageTransformRouteTest.php
===================================================================
--- 
plugins/sfImageTransformExtraPlugin/trunk/test/unit/lib/routing/sfImageTransformRouteTest.php
       2010-03-23 19:43:25 UTC (rev 28737)
+++ 
plugins/sfImageTransformExtraPlugin/trunk/test/unit/lib/routing/sfImageTransformRouteTest.php
       2010-03-23 20:31:35 UTC (rev 28738)
@@ -13,6 +13,8 @@
 
 /** central bootstrap for unit tests */
 require_once dirname(__FILE__).'/../../../bootstrap/unit.php';
+/** Doctrine test record for mocking */
+require_once dirname(__FILE__).'/../../../fixtures/model/TestRecord.php';
 /** PHPUnit Framework */
 require_once 'PHPUnit/Framework.php';
 
@@ -27,28 +29,42 @@
 {
   public function testGenerate()
   {
-    $this->assertEquals('/thumbnails/Model/default/00/00/00/bar-foo-0.jpg', 
$this->route->generate(
+    $this->assertEquals('/thumbnails/Model/default/0.jpg', 
$this->route->generate(
       array(
         'format' => 'default',
         'type' => 'Model',
-        'path' => '00/00/00',
-        'slug' => 'bar-foo',
         'id' => '0',
         'sf_format' => 'jpg'
       )
     ));
   }
 
-  public function testBind()
+  public function testGenerateFromObject()
   {
-    $this->route->bind(null, array());
-    $this->assertTrue($this->route->isBound());
+    $obj = new TestRecord();
+    $this->assertEquals('/thumbnails/TestRecord/default/1.gif', 
$this->route->generate(
+      array(
+        'format' => 'default',
+        'sf_subject' => $obj
+      )
+    ));
   }
 
+  public function testGetImageSourceStreamWrapper()
+  {
+    $this->assertEquals('sfImageSourceDoctrine', 
$this->route->getImageSourceStreamWrapper());
+  }
+
+  public function testGetImageSourceURI()
+  {
+    $this->route->bind(null, array('type' => 'TestRecord', 'attribute' => 
'file', 'id' => '1'));
+    $this->assertEquals('sfImageSource://TestRecord/file#1', 
$this->route->getImageSourceURI());
+  }
+
   protected function setUp()
   {
     $this->route = new sfImageTransformRoute(
-      '/thumbnails/:type/:format/:path/:slug-:id.:sf_format',
+      '/thumbnails/:type/:format/:id.:sf_format',
       array(
         'module' => 'sfImageTransformator',
         'action' => 'index'
@@ -62,13 +78,9 @@
         'sf_method' => array('get')
       ),
       array(
+        'image_source' => 'Doctrine',
         'segment_separators' => array('/', '.', '-')
       )
     );
   }
-
-  protected function tearDown()
-  {
-    unset($this->route);
-  }
 }

Modified: 
plugins/sfImageTransformExtraPlugin/trunk/test/unit/lib/source/sfImageSourceDoctrineTest.php
===================================================================
--- 
plugins/sfImageTransformExtraPlugin/trunk/test/unit/lib/source/sfImageSourceDoctrineTest.php
        2010-03-23 19:43:25 UTC (rev 28737)
+++ 
plugins/sfImageTransformExtraPlugin/trunk/test/unit/lib/source/sfImageSourceDoctrineTest.php
        2010-03-23 20:31:35 UTC (rev 28738)
@@ -14,7 +14,7 @@
 /** central bootstrap for unit tests */
 require_once dirname(__FILE__).'/../../../bootstrap/unit.php';
 /** Doctrine test record for mocking */
-require_once dirname(__FILE__).'/../../../bootstrap/TestRecord.php';
+require_once dirname(__FILE__).'/../../../fixtures/model/TestRecord.php';
 /** PHPUnit Framework */
 require_once 'PHPUnit/Framework.php';
 

Modified: 
plugins/sfImageTransformExtraPlugin/trunk/test/unit/lib/source/sfImageSourcePropelTest.php
===================================================================
--- 
plugins/sfImageTransformExtraPlugin/trunk/test/unit/lib/source/sfImageSourcePropelTest.php
  2010-03-23 19:43:25 UTC (rev 28737)
+++ 
plugins/sfImageTransformExtraPlugin/trunk/test/unit/lib/source/sfImageSourcePropelTest.php
  2010-03-23 20:31:35 UTC (rev 28738)
@@ -13,8 +13,6 @@
 
 /** central bootstrap for unit tests */
 require_once dirname(__FILE__).'/../../../bootstrap/unit.php';
-/** Propel test record for mocking */
-require_once dirname(__FILE__).'/../../../bootstrap/TestRecord.php';
 /** PHPUnit Framework */
 require_once 'PHPUnit/Framework.php';
 

-- 
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