فهرست منبع

Merge remote branch 'kriswallsmith/assetic/rm-event'

Fabien Potencier 14 سال پیش
والد
کامیت
adf3d02695

+ 1 - 8
src/Symfony/Bundle/AsseticBundle/CacheWarmer/AssetWriterCacheWarmer.php

@@ -14,27 +14,20 @@ namespace Symfony\Bundle\AsseticBundle\CacheWarmer;
 use Assetic\AssetManager;
 use Assetic\AssetWriter;
 use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmer;
-use Symfony\Component\EventDispatcher\Event;
-use Symfony\Component\EventDispatcher\EventDispatcher;
 
 class AssetWriterCacheWarmer extends CacheWarmer
 {
     protected $am;
     protected $writer;
-    protected $dispatcher;
 
-    public function __construct(AssetManager $am, AssetWriter $writer, EventDispatcher $dispatcher)
+    public function __construct(AssetManager $am, AssetWriter $writer)
     {
         $this->am = $am;
         $this->writer = $writer;
-        $this->dispatcher = $dispatcher;
     }
 
     public function warmUp($cacheDir)
     {
-        // notify an event so custom stream wrappers can be registered lazily
-        $this->dispatcher->notify(new Event(null, 'assetic.write'));
-
         $this->writer->writeManagerAssets($this->am);
     }
 

+ 0 - 1
src/Symfony/Bundle/AsseticBundle/Resources/config/asset_writer.xml

@@ -14,7 +14,6 @@
             <tag name="kernel.cache_warmer" />
             <argument type="service" id="assetic.asset_manager" />
             <argument type="service" id="assetic.asset_writer" />
-            <argument type="service" id="event_dispatcher" />
         </service>
         <service id="assetic.asset_writer" class="%assetic.asset_writer.class%" public="false">
             <argument>%assetic.write_to%</argument>

+ 1 - 8
src/Symfony/Bundle/AsseticBundle/Tests/CacheWarmer/AssetWriterCacheWarmerTest.php

@@ -12,7 +12,6 @@
 namespace Symfony\Bundle\AsseticBundle\Tests\CacheWarmer;
 
 use Symfony\Bundle\AsseticBundle\CacheWarmer\AssetWriterCacheWarmer;
-use Symfony\Component\EventDispatcher\Event;
 
 class AssetWriterCacheWarmerTest extends \PHPUnit_Framework_TestCase
 {
@@ -29,18 +28,12 @@ class AssetWriterCacheWarmerTest extends \PHPUnit_Framework_TestCase
         $writer = $this->getMockBuilder('Assetic\\AssetWriter')
             ->disableOriginalConstructor()
             ->getMock();
-        $dispatcher = $this->getMock('Symfony\\Component\\EventDispatcher\\EventDispatcher');
 
-        $event = new Event(null, 'assetic.write');
-
-        $dispatcher->expects($this->once())
-            ->method('notify')
-            ->with($event);
         $writer->expects($this->once())
             ->method('writeManagerAssets')
             ->with($am);
 
-        $warmer = new AssetWriterCacheWarmer($am, $writer, $dispatcher);
+        $warmer = new AssetWriterCacheWarmer($am, $writer);
         $warmer->warmUp('/path/to/cache');
     }
 }