Permalink
Browse files

Fix missing tests and exception

  • Loading branch information...
REBELinBLUE committed Sep 16, 2018
1 parent 8a405e0 commit dd50470dc89076ed4d1ebe944fe802e6b28f001c
@@ -0,0 +1,12 @@
<?php
namespace REBELinBLUE\Deployer\Exceptions;
use Exception;
/**
* Exception thrown when the URL check does not find the expected content
*/
class CheckUrlMatchException extends Exception
{
}
@@ -51,10 +51,13 @@ public function handle(Client $client)
try {
$request = $client->get($link->url);
if (!empty($link->match) && !is_null($link->match)) {
$body = (string)$request->getBody();
if (! preg_match('~'.htmlentities(trim(preg_quote($link->match, '~'))).'~i', $body)) {
throw new CheckUrlMatchException('The URL is live but we could not find the "'.$link->match.'" content into it');
if (!empty($link->match)) {
$body = (string) $request->getBody();
if (!preg_match('~' . htmlentities(trim(preg_quote($link->match, '~'))) . '~i', $body)) {
throw new CheckUrlMatchException(
'The URL is live but we could not find the "' . $link->match . '" content'
);
}
}
@@ -1,15 +1,13 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateUrlMatchColumn extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
@@ -21,8 +19,6 @@ public function up()
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Oops, something went wrong.

0 comments on commit dd50470

Please sign in to comment.