Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added doc file and some modifications to Tests

  • Loading branch information...
commit 8d1e0e38c49ef0b2746146fbe29243fdf82df3b1 1 parent a888977
Kavith Thiranga Lokuhewage authored
8 docs/manual/en-US/chapters/packages/media.md
View
@@ -0,0 +1,8 @@
+## The Media Package
+
+### Introduction
+
+The *Media* package is designed to compile and compress assets such as `Javascript` and `CSS` files.
+
+### Abstract Classes
+
34 tests/suites/unit/joomla/media/combiner/JMediaCombinerCssTest.php
View
@@ -20,28 +20,40 @@ class JMediaCombinerCssTest extends TestCase
*/
protected $object;
+ protected $files;
+
+ protected $pathToTestFiles;
+
+ protected $suffix;
/**
- * Sets up the fixture, for example, opens a network connection.
- * This method is called before a test is executed.
- */
+ * Sets up the fixture, for example, opens a network connection.
+ * This method is called before a test is executed.
+ */
protected function setUp()
{
$this->object = JMediaCollection::getInstance(array('type' => 'css'));
+ $this->pathToTestFiles = JPATH_BASE . '/test_files/css';
+ $this->loadFiles();
+ $this->suffix = 'min';
}
-
- public function testCombine()
+ /**
+ * Loads Necessary files
+ */
+ protected function loadFiles()
{
+ //
+ $this->files = glob($this->pathToTestFiles . DIRECTORY_SEPARATOR . '*.css');
}
- public function loadCssFiles()
+
+ public function testCombine()
{
- // Path to source css files
- $path = JPATH_BASE . '/test_files/css';
+ $this->object->addFiles($this->files);
+
+ $this->object->combine();
- $files = JFolder::files($path,'.',false,true, array(), array('.min.css', '.php', '.html','.combined.css'));//get full path
- return $files;
}
-}
+}
29 tests/suites/unit/joomla/media/combiner/JMediaCombinerJsTest.php
View
@@ -20,6 +20,11 @@ class JMediaCombinerJsTest extends TestCase
*/
protected $object;
+ protected $files;
+
+ protected $pathToTestFiles;
+
+ protected $suffix;
/**
* Sets up the fixture, for example, opens a network connection.
@@ -28,25 +33,27 @@ class JMediaCombinerJsTest extends TestCase
protected function setUp()
{
$this->object = JMediaCollection::getInstance(array('type' => 'js'));
+ $this->pathToTestFiles = JPATH_BASE . '/test_files/js';
+ $this->loadFiles();
+ $this->suffix = 'min';
}
-
- public function testCombine()
+ /**
+ * Loads Necessary files
+ */
+ protected function loadFiles()
{
- $this->object->addFiles($this->loadJsFiles());
-
- $this->object->combine();
-
+ //
+ $this->files = glob($this->pathToTestFiles . DIRECTORY_SEPARATOR . '*.js');
}
- public function loadJsFiles()
+
+ public function testCombine()
{
- // Path to source css files
- $path = JPATH_BASE . '/test_files/js';
+ $this->object->addFiles($this->files);
- $files = JFolder::files($path,'.',false,true, array(), array('.min.js', '.php', '.html','.combined.js'));//get full path
+ $this->object->combine();
- return $files;
}
}
18 tests/suites/unit/joomla/media/compressor/JMediaCompressorCssTest.php
View
@@ -20,6 +20,12 @@ class JMediaCompressorCssTest extends TestCase
*/
protected $object;
+ protected $files;
+
+ protected $pathToTestFiles;
+
+ protected $suffix;
+
/**
* Sets up the fixture, for example, opens a network connection.
@@ -28,6 +34,18 @@ class JMediaCompressorCssTest extends TestCase
protected function setUp()
{
$this->object = JMediaCompressor::getInstance(array('type' => 'css'));
+ $this->pathToTestFiles = JPATH_BASE . '/test_files/css';
+ $this->loadFiles();
+ $this->suffix = 'min';
+ }
+
+ /**
+ * Loads Necessary files
+ */
+ protected function loadFiles()
+ {
+ //
+ $this->files = glob($this->pathToTestFiles . DIRECTORY_SEPARATOR . '*.css');
}
public function testSetOptions()
18 tests/suites/unit/joomla/media/compressor/JMediaCompressorJsTest.php
View
@@ -21,6 +21,12 @@ class JMediaCompressorJsTest extends TestCase
*/
protected $object;
+ protected $files;
+
+ protected $pathToTestFiles;
+
+ protected $suffix;
+
/**
* Sets up the fixture, for example, opens a network connection.
@@ -29,6 +35,18 @@ class JMediaCompressorJsTest extends TestCase
protected function setUp()
{
$this->object = JMediaCompressor::getInstance(array('type' => 'js'));
+ $this->pathToTestFiles = JPATH_BASE . '/test_files/js';
+ $this->loadFiles();
+ $this->suffix = 'min';
+ }
+
+ /**
+ * Loads Necessary files
+ */
+ protected function loadFiles()
+ {
+ //
+ $this->files = glob($this->pathToTestFiles . DIRECTORY_SEPARATOR . '*.js');
}
public function testSetOptions()
Please sign in to comment.
Something went wrong with that request. Please try again.