Skip to content

Commit

Permalink
Added more tests
Browse files Browse the repository at this point in the history
Moved zero routes check to artisan command for testability purposes
Changed js file paths
Removed public folder
Updated changelog
  • Loading branch information
diegonz committed Apr 12, 2019
1 parent ba91b40 commit 6ffef28
Show file tree
Hide file tree
Showing 25 changed files with 152 additions and 282 deletions.
6 changes: 3 additions & 3 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

# Folders:
/.github export-ignore
/public export-ignore
/tests export-ignore

# Files:
Expand All @@ -18,11 +17,12 @@
/.styleci.yml export-ignore
/CHANGELOG.md export-ignore
/CONTRIBUTING.md export-ignore
/README.md export-ignore
/gruntfile.js export-ignore
/laroute.png export-ignore
/karma.conf.js export-ignore
/karma.js export-ignore
/laroute.png export-ignore
/package.json export-ignore
/package.json.lock export-ignore
/phpunit.xml.dist export-ignore
/README.md export-ignore
/run-tests.sh export-ignore
17 changes: 8 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
build
docs
vendor
node_modules
coverage
phpunit.xml
composer.phar
composer.lock
.idea
/.idea
/build
/public
/vendor
/node_modules
/coverage
/composer.lock
/composer.phar
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ All notable changes to this project will be documented in this file.
- Added .styleci.yml config file
- Added .gitattributes file
- Added PHP 7.1, 7.2 and 7.3 support
- Added package auto discovery
- Added orchestra/testbench as dev dependency
- Added artisan command simple file creation test, generating a template js file for karma tests.
- Added more tests

### Changed

Expand All @@ -21,10 +22,13 @@ All notable changes to this project will be documented in this file.
- Updated config files
- Renamed README filename
- Renamed phpunit.xml to phpunit.xml.dist
- Moved zero routes check to artisan command for testability purposes
- Changed js file paths

### Removed

- Removed support for Laravel versions lower than 5.5
- Removed public folder

## [2.4.8] - 2018-09-11

Expand Down
2 changes: 1 addition & 1 deletion config/laroute.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
* the ported helper Laravel url/route functions and the route data to go
* with them.
*/
'template' => 'vendor/diegonz/laroute/src/templates/laroute.js',
'template' => 'vendor/diegonz/laroute/resources/js/templates/laroute.min.js',

/*
* Appends a prefix to URLs. By default the prefix is an empty string.
Expand Down
2 changes: 1 addition & 1 deletion gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = function (grunt) {
uglify : {
build : {
files : {
'src/templates/laroute.min.js' : 'src/templates/laroute.js'
'resources/js/templates/laroute.min.js' : 'resources/js/templates/laroute.js'
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = function (config) {
files: [
'karma.js',
{pattern: 'public/js/**/*.js', included: false},
{pattern: 'tests/public/js/**/*Spec.js', included: false}
{pattern: 'tests/js/**/*Spec.js', included: false}
],

// list of files / patterns to exclude
Expand Down Expand Up @@ -53,7 +53,7 @@ module.exports = function (config) {

// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
// PhantomJS throws an error due to full page reloading
// PhantomJS throws an error due to full page reloading or timeout
browsers: ['Chrome', 'Firefox'],


Expand Down
Empty file removed public/.gitkeep
Empty file.
1 change: 0 additions & 1 deletion public/js/.gitignore

This file was deleted.

Empty file removed public/js/.gitkeep
Empty file.
193 changes: 0 additions & 193 deletions public/js/laroute.js

This file was deleted.

File renamed without changes.
File renamed without changes.
55 changes: 55 additions & 0 deletions run-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/usr/bin/env bash

# GET SCRIPT PATH
SOURCE="${BASH_SOURCE[0]}"
# Resolve $SOURCE until the file is no longer a symlink
while [[ -h "$SOURCE" ]]; do
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
SOURCE="$(readlink "$SOURCE")"
# if $SOURCE was a relative symlink, we need to resolve it relative
# to the path where the symlink file was located
[[ ${SOURCE} != /* ]] && SOURCE="$DIR/$SOURCE"
done
SCRIPT_PATH="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
if [[ -z "$SCRIPT_PATH" ]] ; then
exit 1 # fail
fi

# CD TO SCRIPT PATH
cd ${SCRIPT_PATH}

# CHECK TEST DEPENDENCIES
if ! hash grunt; then
echo "You must have grunt-cli installed!"
exit 1
fi
if [[ ! -f ./composer.phar ]] && ! hash composer; then
echo "You must have composer installed or PHP and composer.phar!"
exit 1
fi
if ! hash npm; then
echo "You must have npm installed!"
exit 1
fi

# GET TOOLS PATHS
if [[ -f ./composer.phar ]]; then
if ! hash php; then
echo "You must have PHP installed!"
exit 1
fi
PHP_BIN=$(which php)
COMPOSER_BIN="$PHP_BIN ./composer.phar"
else
COMPOSER_BIN=$(which composer)
fi
GRUNT_BIN=$(which grunt)
NPM_BIN=$(which npm)

# RUN TESTS
# Uglify/minify JS template file
${GRUNT_BIN}
# Run PHP tests
${COMPOSER_BIN} test
# Run JS tests
${NPM_BIN} test
Loading

0 comments on commit 6ffef28

Please sign in to comment.