From 2fcb1d66a5ec9230e197abde576517441a9deeca Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Wed, 4 May 2016 09:53:43 +0300 Subject: [PATCH] Fix for travis tests --- .travis.yml | 3 ++- app/Exceptions/Handler.php | 2 +- app/Libraries/Utils.php | 5 +++++ app/Ninja/Transformers/ProductTransformer.php | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 083bbe4f25..1f66f7aa29 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,7 +45,8 @@ before_script: - php artisan key:generate --no-interaction - sed -i 's/APP_ENV=production/APP_ENV=development/g' .env - sed -i 's/APP_DEBUG=false/APP_DEBUG=true/g' .env - - sed -i 's/REQUIRE_HTTPS=false/NINJA_DEV=true/g' .env + - sed -i '$a NINJA_DEV=true' .env + - sed -i '$a TRAVIS=true' .env # create the database and user - mysql -u root -e "create database IF NOT EXISTS ninja;" - mysql -u root -e "GRANT ALL PRIVILEGES ON ninja.* To 'ninja'@'localhost' IDENTIFIED BY 'ninja'; FLUSH PRIVILEGES;" diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 5333d90f9e..2a8b0d3052 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -39,7 +39,7 @@ class Handler extends ExceptionHandler { return false; } - if (Utils::isNinja()) { + if (Utils::isNinja() && ! Utils::isTravis()) { Utils::logError(Utils::getErrorString($e)); return false; } else { diff --git a/app/Libraries/Utils.php b/app/Libraries/Utils.php index 141eacfc30..7c1b11dfd8 100644 --- a/app/Libraries/Utils.php +++ b/app/Libraries/Utils.php @@ -51,6 +51,11 @@ class Utils return php_sapi_name() == 'cli'; } + public static function isTravis() + { + return env('TRAVIS') == 'true'; + } + public static function isNinja() { return self::isNinjaProd() || self::isNinjaDev(); diff --git a/app/Ninja/Transformers/ProductTransformer.php b/app/Ninja/Transformers/ProductTransformer.php index 8331d76661..309305815f 100644 --- a/app/Ninja/Transformers/ProductTransformer.php +++ b/app/Ninja/Transformers/ProductTransformer.php @@ -7,7 +7,7 @@ class ProductTransformer extends EntityTransformer { public function transform(Product $product) { - return array_merge($this->getDefaults(), [ + return array_merge($this->getDefaults($product), [ 'id' => (int) $product->public_id, 'product_key' => $product->product_key, 'notes' => $product->notes,