@@ -64,13 +64,37 @@ public function testBuildFile()
6464 $ request = $ this ->request ->withUri ($ uri );
6565
6666 $ result = $ this ->middleware ->process ($ request , $ this ->handler );
67- $ this ->assertEquals ('application/javascript ' , $ result ->getHeaderLine ('Content-Type ' ));
6867
6968 $ body = $ result ->getBody ()->getContents ();
7069 $ this ->assertStringContainsString ('var BaseClass = new Class ' , $ body );
7170 $ this ->assertStringContainsString ('var Template = new Class ' , $ body );
7271 }
7372
73+ public function contentTypesProvider ()
74+ {
75+ return [
76+ ['/cache_js/libs.js ' , 'application/javascript ' ],
77+ ['/cache_css/all.css ' , 'text/css ' ],
78+ ['/cache_svg/foo.bar.svg ' , 'image/svg+xml ' ],
79+ ];
80+ }
81+
82+ /**
83+ * test returned content types
84+ *
85+ * @dataProvider contentTypesProvider
86+ * @return void
87+ */
88+ public function testBuildFileContentTypes ($ path , $ expected )
89+ {
90+ $ uri = $ this ->request ->getUri ()->withPath ($ path );
91+ $ request = $ this ->request ->withUri ($ uri );
92+
93+ $ result = $ this ->middleware ->process ($ request , $ this ->handler );
94+
95+ $ this ->assertEquals ($ expected , $ result ->getHeaderLine ('Content-Type ' ));
96+ }
97+
7498 /**
7599 * test building plugin assets.
76100 *
@@ -85,8 +109,6 @@ public function testPluginIniBuildFile()
85109
86110 $ result = $ this ->middleware ->process ($ request , $ this ->handler );
87111
88- $ this ->assertEquals ('application/javascript ' , $ result ->getHeaderLine ('Content-Type ' ));
89-
90112 $ body = $ result ->getBody ()->getContents ();
91113 $ this ->assertStringContainsString ('var BaseClass = new Class ' , $ body );
92114 $ this ->assertStringContainsString ('var Template = new Class ' , $ body );
@@ -105,7 +127,6 @@ public function testBuildFileIsCached()
105127 $ result = $ this ->middleware ->process ($ request , $ this ->handler );
106128
107129 $ body = $ result ->getBody ()->getContents ();
108- $ this ->assertEquals ('application/javascript ' , $ result ->getHeaderLine ('Content-Type ' ));
109130 $ this ->assertStringContainsString ('BaseClass ' , $ body );
110131
111132 $ this ->assertTrue (file_exists (CACHE . 'asset_compress ' . DS . 'libs.js ' ), 'Cache file was created. ' );
@@ -142,7 +163,6 @@ public function testBuildThemedAsset()
142163 $ result = $ this ->middleware ->process ($ request , $ this ->handler );
143164
144165 $ body = $ result ->getBody ()->getContents ();
145- $ this ->assertEquals ('text/css ' , $ result ->getHeaderLine ('Content-Type ' ));
146166 $ this ->assertStringContainsString ('color: blue ' , $ body );
147167 }
148168
0 commit comments