Skip to content

Commit

Permalink
Merge pull request #1 from Crecket/develop
Browse files Browse the repository at this point in the history
Added

Unit tests
Removed files from url, this means all file names are completely hidden
Auto prefixer for css values
Better synthax and logic
Improved performance
  • Loading branch information
Crecket committed Apr 23, 2016
2 parents 2e8b022 + 2d2cc18 commit 1740feb
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 28 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
/index.php
/minify.php
/cache
/phpunit.phar
/phpunit.phar
/phpunit-4.5.0.phar
/tests/cache
13 changes: 10 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
language: php

php:
- "5.6"
- "7.0"
- 5.6
- 7.0

script: phpunit tests/test.php

install:
- composer self-update
- composer update -o
- npm install -g bower
- bower install
- phpunit --version

matrix:
allow_failures:
- php: 5.6
5 changes: 2 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@
"tedivm/jshrink": "^1.1",
"twig/twig": "^1.23",
"oyejorge/less.php": "v1.7.0.10",
"css-crush/css-crush": "*",
"phpunit/phpunit": "^5.3"
"css-crush/css-crush": "*"
},
"require-dev": {
"phpunit/phpunit": "^5.3"
"phpunit/phpunit": "*"
},
"autoload": {
"psr-4": {
Expand Down
10 changes: 0 additions & 10 deletions src/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,16 +114,6 @@ public function __construct($options, $input_file_list = false)
// Create cache element
$this->cache = new FilesystemCache($this->options['Cache']);

// Required option
if (empty($this->options['Remote_storage'])) {
throw new Exception('Remote file error', 'Missing remote file storage location');
} else if (!file_exists($this->options['Remote_storage'])) {
throw new Exception('Remote file error', 'Storage location not found');
}

// set remote file storage location
$this->remote_storage = $this->options['Remote_storage'];

// Required option
if (!empty($this->options['CacheNameSpace'])) {
$this->cache->setNamespace('crecket_dependency_loader');
Expand Down
17 changes: 6 additions & 11 deletions tests/test.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php
require __DIR__ . '/../vendor/autoload.php';

// TODO bower install: https://github.com/sebastianbergmann/phpunit-website

class testMain extends PHPUnit_Framework_TestCase
{

Expand All @@ -27,19 +25,19 @@ public function testSecret()

public function testGetLinks()
{
$this->assertEquals(\Crecket\DependencyManager\Loader::getCssLink(true), '?secret=ca48b5ff1fc8d475b138b336e49e0d2adc3bb11ef5546ac855045be2a17957a5&minify=true');
$this->assertEquals(\Crecket\DependencyManager\Loader::getCssLink(false), '?secret=ca48b5ff1fc8d475b138b336e49e0d2adc3bb11ef5546ac855045be2a17957a5');
$this->assertEquals(\Crecket\DependencyManager\Loader::getJsLink(true), '?secret=e195b9eaeaa09cab85600a86bfb7e88b34903088146706600191355b4191af0a&minify=true');
$this->assertEquals(\Crecket\DependencyManager\Loader::getJsLink(false), '?secret=e195b9eaeaa09cab85600a86bfb7e88b34903088146706600191355b4191af0a');
// TODO create better test case for link generation
$this->assertNotEmpty(\Crecket\DependencyManager\Loader::getCssLink(true));
$this->assertNotEmpty(\Crecket\DependencyManager\Loader::getCssLink(false));
$this->assertNotEmpty(\Crecket\DependencyManager\Loader::getJsLink(true));
$this->assertNotEmpty(\Crecket\DependencyManager\Loader::getJsLink(false));
}

public function testResponse()
{
define('ROOT', __DIR__);

$options = array(
'Cache' => ROOT.'/cache',
'Remote_storage' => ROOT.'/bower_components/'
'Cache' => ROOT.'/cache'
);

$jsList = array(
Expand All @@ -61,7 +59,4 @@ public function testResponse()
$CssResponse = new \Crecket\DependencyManager\Response($options, $cssList);
$this->assertNotEmpty($CssResponse->getResult());
}

// TODO Session testing

}

0 comments on commit 1740feb

Please sign in to comment.