From 42b0352e7303b8aaa25c296a8c8529f2c0054321 Mon Sep 17 00:00:00 2001
From: Thibault Debatty <thibault.debatty@gmail.com>
Date: Thu, 19 Jul 2018 14:34:10 +0200
Subject: [PATCH] Add gitlab ci + fix style

---
 .gitlab-ci.yml         | 16 ++++++++++++++++
 .travis.yml            |  8 --------
 tests/DetectorTest.php | 18 +++++++++++-------
 3 files changed, 27 insertions(+), 15 deletions(-)
 create mode 100644 .gitlab-ci.yml
 delete mode 100644 .travis.yml

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..7c9eeb5
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,16 @@
+# https://hub.docker.com/_/php/
+image: php:7.1
+
+before_script:
+  # Install git, the php image doesn't have installed
+  - apt-get update -yqq
+  - apt-get install git -yqq
+  # Install composer
+  - curl -sS https://getcomposer.org/installer | php
+  # Install all project dependencies
+  - php composer.phar install
+
+test:
+  script:
+    - vendor/bin/phpunit --coverage-text
+    - vendor/bin/phpcs
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 075c03e..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,8 +0,0 @@
-language: php
-php:
-  - '7.1'
-before_script:
-  - composer install --dev
-script: vendor/bin/phpunit && vendor/bin/phpcs
-notifications:
-    slack: cylab-be:9G7YN9rr7PernXgkfvCzHB2a
diff --git a/tests/DetectorTest.php b/tests/DetectorTest.php
index 8af89ec..5ed1faa 100644
--- a/tests/DetectorTest.php
+++ b/tests/DetectorTest.php
@@ -43,17 +43,21 @@ class DetectorTest extends TestCase
     /**
      * Check that we don't get an error if we analyze a PHP file with an open comment
      * block.
+     *
+     * @return void
      */
     public function testComment()
     {
-        set_error_handler(function($errno, $errstr, $errfile, $errline, array $errcontext) {
-            // error was suppressed with the @-operator
-            //if (0 === error_reporting()) {
-            //    return false;
-            //}
+        set_error_handler(
+            function ($errno, $errstr, $errfile, $errline, array $errcontext) {
+                // error was suppressed with the @-operator
+                //if (0 === error_reporting()) {
+                //    return false;
+                //}
 
-            throw new  \ErrorException($errstr, 0, $errno, $errfile, $errline);
-        });
+                throw new  \ErrorException($errstr, 0, $errno, $errfile, $errline);
+            }
+        );
         $detector = new Detector();
         $detector->analyzeString(file_get_contents(__DIR__ . "/res/comment.php"));
 
-- 
GitLab