From db71d8c3448fb6b0bcf9c7e1f53bda3b16b7b5e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Sun, 30 Jul 2017 17:15:10 +0200 Subject: [PATCH 01/29] Remove debug things from composer --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 19e9cb50d..a758e9bd2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ services: - mysql before_script: - '! find . -type f -name "*.php" -exec php -d error_reporting=32767 -l {} \; 2>&1 >&- | grep "^"' - - php -S + - php -S 0.0.0.0:8000 - mysql -e 'CREATE DATABASE 2moons;' php: - '7.0' From 7677d941fdfc86f342c8d903bc1399315210b667 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Sun, 30 Jul 2017 17:25:00 +0200 Subject: [PATCH 02/29] Remove debug things from composer --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index a758e9bd2..6294efb5e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,5 @@ --- +dist: trusty sudo: false language: php services: From 8ccefec16b9feb3a1a7c25544abe89f5ea1e5780 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Sun, 30 Jul 2017 17:27:24 +0200 Subject: [PATCH 03/29] Added default cred. --- .travis.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.travis.yml b/.travis.yml index 6294efb5e..0cd4f9394 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,5 +12,13 @@ php: - '7.0' install: - composer install +env: + - DB_HOST: localhost + - DB_USER: travis + - DB_PASSWORD: + - DB_NAME: 2moons + - ADMIN_NAME: admin + - ADMIN_PASSWORD: admin + - ADMIN_MAIL: mail@example.com script: phantomjs tests/run.js \ No newline at end of file From 37900671f4cf0545a1d0b836a618f3e7ea33180f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Sun, 30 Jul 2017 17:30:43 +0200 Subject: [PATCH 04/29] Added cache --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index 0cd4f9394..bf07f0f4f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,4 +21,8 @@ env: - ADMIN_PASSWORD: admin - ADMIN_MAIL: mail@example.com +cache: + directories: + - $HOME/.composer/cache/files + script: phantomjs tests/run.js \ No newline at end of file From 2896ebd85225db615a6e4fb3fd94d688d617fd2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Thu, 3 Aug 2017 17:34:23 +0200 Subject: [PATCH 05/29] Added cache --- .travis.yml | 5 ++++- composer.json | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index bf07f0f4f..156bb37ea 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,11 +2,14 @@ dist: trusty sudo: false language: php +addons: + chrome: stable services: - mysql before_script: - '! find . -type f -name "*.php" -exec php -d error_reporting=32767 -l {} \; 2>&1 >&- | grep "^"' - php -S 0.0.0.0:8000 + - google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost:8000s & - mysql -e 'CREATE DATABASE 2moons;' php: - '7.0' @@ -25,4 +28,4 @@ cache: directories: - $HOME/.composer/cache/files -script: phantomjs tests/run.js \ No newline at end of file +script: '! find . -type f -name "*.php" -exec php -d error_reporting=32767 -l {} \; 2>&1 >&- | grep "^"' \ No newline at end of file diff --git a/composer.json b/composer.json index c80841d5b..1d57383c1 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,6 @@ "name": "2moons/2moons", "description": "Online browser game.", "type": "project", - "require-dev": {}, "license": "MIT", "authors": [ { @@ -11,5 +10,8 @@ } ], "minimum-stability": "stable", - "require": {} + "require": {}, + "require-dev": { + "phpunit/phpunit-selenium": "~3.0" + } } From 77805e985f5d229c056922ebe30e0466b77fba9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Thu, 3 Aug 2017 17:53:19 +0200 Subject: [PATCH 06/29] FIXED ENV --- .travis.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 156bb37ea..0dffe4e48 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,13 +16,7 @@ php: install: - composer install env: - - DB_HOST: localhost - - DB_USER: travis - - DB_PASSWORD: - - DB_NAME: 2moons - - ADMIN_NAME: admin - - ADMIN_PASSWORD: admin - - ADMIN_MAIL: mail@example.com + - DB_HOST=localhost DB_USER=travis DB_PASSWORD=DB_NAME=2moons ADMIN_NAME=admin ADMIN_PASSWORD=admin ADMIN_MAIL=mail@example.com cache: directories: From 5aef938ea652063f7791b8b99a6c5a03cacb1b39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Thu, 3 Aug 2017 17:54:22 +0200 Subject: [PATCH 07/29] FIXED ENV --- .travis.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0dffe4e48..ff361f30b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,13 @@ php: install: - composer install env: - - DB_HOST=localhost DB_USER=travis DB_PASSWORD=DB_NAME=2moons ADMIN_NAME=admin ADMIN_PASSWORD=admin ADMIN_MAIL=mail@example.com + global: + - DB_HOST=localhost + - DB_USER=travis + - DB_PASSWORD=DB_NAME=2moons + - ADMIN_NAME=admin + - ADMIN_PASSWORD=admin + - ADMIN_MAIL=mail@example.com cache: directories: From 459288a01461ea4b4eaa09fef9780c1287b5d452 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Thu, 3 Aug 2017 17:57:44 +0200 Subject: [PATCH 08/29] FIXED ENV --- .travis.yml | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index ff361f30b..8fb2e3166 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,19 +2,14 @@ dist: trusty sudo: false language: php -addons: - chrome: stable + services: - mysql -before_script: - - '! find . -type f -name "*.php" -exec php -d error_reporting=32767 -l {} \; 2>&1 >&- | grep "^"' - - php -S 0.0.0.0:8000 - - google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost:8000s & - - mysql -e 'CREATE DATABASE 2moons;' -php: - - '7.0' -install: - - composer install + +cache: + directories: + - $HOME/.composer/cache/files + env: global: - DB_HOST=localhost @@ -24,8 +19,22 @@ env: - ADMIN_PASSWORD=admin - ADMIN_MAIL=mail@example.com -cache: - directories: - - $HOME/.composer/cache/files +php: + - '7.0' + +matrix: + fast_finish: true + +install: + - mysql -e 'CREATE DATABASE IF NOT EXISTS 2moons;' -uroot + - php -S 0.0.0.0:8000 +# - google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost:8000s & + - composer install + +before_script: + # Start a web server on port 8888, run in the background; wait for + # initialization. + - nohup php -S localhost:8888 > /dev/null 2>&1 & -script: '! find . -type f -name "*.php" -exec php -d error_reporting=32767 -l {} \; 2>&1 >&- | grep "^"' \ No newline at end of file +script: + - '! find . -type f -name "*.php" -exec php -d error_reporting=32767 -l {} \; 2>&1 >&- | grep "^"' \ No newline at end of file From 302307d4f65f105ba08d17321b39c2f2d8358534 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Sat, 5 Aug 2017 13:22:05 +0200 Subject: [PATCH 09/29] FIXED ENV --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 8fb2e3166..36ba8abde 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,7 +27,6 @@ matrix: install: - mysql -e 'CREATE DATABASE IF NOT EXISTS 2moons;' -uroot - - php -S 0.0.0.0:8000 # - google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost:8000s & - composer install From f6afcc8d9c5e7285f9acdd57043cfa9fe01b427e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Sat, 5 Aug 2017 13:32:34 +0200 Subject: [PATCH 10/29] FIXED ENV --- .travis.yml | 3 +-- composer.json | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 36ba8abde..03809008e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,7 +27,6 @@ matrix: install: - mysql -e 'CREATE DATABASE IF NOT EXISTS 2moons;' -uroot -# - google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost:8000s & - composer install before_script: @@ -36,4 +35,4 @@ before_script: - nohup php -S localhost:8888 > /dev/null 2>&1 & script: - - '! find . -type f -name "*.php" -exec php -d error_reporting=32767 -l {} \; 2>&1 >&- | grep "^"' \ No newline at end of file + - '! find . ! -path "./includes/libs/*" -type f -name "*.php" -exec php -d error_reporting=32767 -l {} \; 2>&1 >&- | grep "^"' \ No newline at end of file diff --git a/composer.json b/composer.json index a82ad2498..494cf5cbf 100644 --- a/composer.json +++ b/composer.json @@ -11,5 +11,8 @@ ], "minimum-stability": "stable", "require": {}, - "require-dev": {} + "require-dev": { + "se/selenium-server-standalone": "~3.4", + "phpunit/phpunit-selenium": "~3" + } } From 91cfa35eafb1ab03ce9195e9973a575d750314c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Sat, 5 Aug 2017 13:32:56 +0200 Subject: [PATCH 11/29] FIXED ENV --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 03809008e..eb8657bb0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,9 @@ language: php services: - mysql +addons: + chrome: stable + cache: directories: - $HOME/.composer/cache/files From f87c8d5bad54b51e416b943a8c06fbd2205f6684 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Sat, 5 Aug 2017 13:38:08 +0200 Subject: [PATCH 12/29] FIXED ENV --- .travis.yml | 1 + tests/index.php | 18 ++++++++++++++++++ tests/run.js | 9 --------- 3 files changed, 19 insertions(+), 9 deletions(-) create mode 100644 tests/index.php delete mode 100644 tests/run.js diff --git a/.travis.yml b/.travis.yml index eb8657bb0..fc56135d9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,6 +35,7 @@ install: before_script: # Start a web server on port 8888, run in the background; wait for # initialization. + - vendor/bin/selenium-server-standalone - nohup php -S localhost:8888 > /dev/null 2>&1 & script: diff --git a/tests/index.php b/tests/index.php new file mode 100644 index 000000000..1d0e62152 --- /dev/null +++ b/tests/index.php @@ -0,0 +1,18 @@ +setBrowser('chrome'); + $this->setBrowserUrl('http://localhost:8888/'); + } + + public function testTitle() + { + $this->url('http://localhost:8888/'); + $this->assertEquals('2Moons'); + } + +} \ No newline at end of file diff --git a/tests/run.js b/tests/run.js deleted file mode 100644 index f04a93d25..000000000 --- a/tests/run.js +++ /dev/null @@ -1,9 +0,0 @@ -console.log('Start running 2moons tests'); - -var page = require('webpage').create(); -var prefix = 'http://localhost:8000'; - - -page.open(prefix, function(status) { - console.log(status); -}); \ No newline at end of file From a749595c05ecbd261259ffc6656192b32703db33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Sat, 5 Aug 2017 13:38:30 +0200 Subject: [PATCH 13/29] FIXED ENV --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index fc56135d9..fd95b5f5d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -39,4 +39,4 @@ before_script: - nohup php -S localhost:8888 > /dev/null 2>&1 & script: - - '! find . ! -path "./includes/libs/*" -type f -name "*.php" -exec php -d error_reporting=32767 -l {} \; 2>&1 >&- | grep "^"' \ No newline at end of file + - '! find . ! -path "./includes/libs/*" ! -path "./vendor/*" -type f -name "*.php" -exec php -d error_reporting=32767 -l {} \; 2>&1 >&- | grep "^"' \ No newline at end of file From b4c8944263208c8c5387bcac43023b8e6d616dfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Sat, 5 Aug 2017 13:40:29 +0200 Subject: [PATCH 14/29] FIXED ENV --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index fd95b5f5d..c4699a67b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,7 +35,7 @@ install: before_script: # Start a web server on port 8888, run in the background; wait for # initialization. - - vendor/bin/selenium-server-standalone + - nohup vendor/bin/selenium-server-standalone > /dev/null 2>&1 & - nohup php -S localhost:8888 > /dev/null 2>&1 & script: From ddca957f97455c5e25fe6c88da91c14d52ef0b93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Sat, 5 Aug 2017 13:46:54 +0200 Subject: [PATCH 15/29] FIXED ENV --- .travis.yml | 3 ++- tests/{index.php => InstallTest.php} | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) rename tests/{index.php => InstallTest.php} (81%) diff --git a/.travis.yml b/.travis.yml index c4699a67b..7080fde82 100644 --- a/.travis.yml +++ b/.travis.yml @@ -39,4 +39,5 @@ before_script: - nohup php -S localhost:8888 > /dev/null 2>&1 & script: - - '! find . ! -path "./includes/libs/*" ! -path "./vendor/*" -type f -name "*.php" -exec php -d error_reporting=32767 -l {} \; 2>&1 >&- | grep "^"' \ No newline at end of file + - '! find . ! -path "./includes/libs/*" ! -path "./vendor/*" -type f -name "*.php" -exec php -d error_reporting=32767 -l {} \; 2>&1 >&- | grep "^"' +# - 'vendor/bin/phpunit' \ No newline at end of file diff --git a/tests/index.php b/tests/InstallTest.php similarity index 81% rename from tests/index.php rename to tests/InstallTest.php index 1d0e62152..89e3b542c 100644 --- a/tests/index.php +++ b/tests/InstallTest.php @@ -1,7 +1,7 @@ Date: Sat, 5 Aug 2017 14:03:04 +0200 Subject: [PATCH 16/29] FIXED ENV --- .travis.yml | 2 +- tests/{ => Install}/InstallTest.php | 2 -- tests/phpunit.xml | 5 +++++ 3 files changed, 6 insertions(+), 3 deletions(-) rename tests/{ => Install}/InstallTest.php (99%) create mode 100644 tests/phpunit.xml diff --git a/.travis.yml b/.travis.yml index 7080fde82..40c69ade2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,4 +40,4 @@ before_script: script: - '! find . ! -path "./includes/libs/*" ! -path "./vendor/*" -type f -name "*.php" -exec php -d error_reporting=32767 -l {} \; 2>&1 >&- | grep "^"' -# - 'vendor/bin/phpunit' \ No newline at end of file + - 'vendor/bin/phpunit --colors ' \ No newline at end of file diff --git a/tests/InstallTest.php b/tests/Install/InstallTest.php similarity index 99% rename from tests/InstallTest.php rename to tests/Install/InstallTest.php index 89e3b542c..c688c14cd 100644 --- a/tests/InstallTest.php +++ b/tests/Install/InstallTest.php @@ -1,6 +1,5 @@ url('http://localhost:8888/'); $this->assertEquals('2Moons'); } - } \ No newline at end of file diff --git a/tests/phpunit.xml b/tests/phpunit.xml new file mode 100644 index 000000000..38b11355f --- /dev/null +++ b/tests/phpunit.xml @@ -0,0 +1,5 @@ + + + ./Install/ + + \ No newline at end of file From f53521cf71bc8bfae81fdc5511f498f649265ad0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Sat, 5 Aug 2017 14:03:43 +0200 Subject: [PATCH 17/29] FIXED ENV --- tests/phpunit.xml => phpunit.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename tests/phpunit.xml => phpunit.xml (73%) diff --git a/tests/phpunit.xml b/phpunit.xml similarity index 73% rename from tests/phpunit.xml rename to phpunit.xml index 38b11355f..55dcfd595 100644 --- a/tests/phpunit.xml +++ b/phpunit.xml @@ -1,5 +1,5 @@ - ./Install/ + ./tests/Install/ \ No newline at end of file From d265eb8708e106854a3abe058a65c8745b36e1ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Sat, 5 Aug 2017 14:07:13 +0200 Subject: [PATCH 18/29] FIXED ENV --- .travis.yml | 6 ++++-- phpunit.xml | 6 +++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 40c69ade2..0895e7989 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,11 +33,13 @@ install: - composer install before_script: + - phpenv config-rm xdebug.ini + - '! find . ! -path "./includes/libs/*" ! -path "./vendor/*" -type f -name "*.php" -exec php -d error_reporting=32767 -l {} \; 2>&1 >&- | grep "^"' # Start a web server on port 8888, run in the background; wait for # initialization. - nohup vendor/bin/selenium-server-standalone > /dev/null 2>&1 & - nohup php -S localhost:8888 > /dev/null 2>&1 & script: - - '! find . ! -path "./includes/libs/*" ! -path "./vendor/*" -type f -name "*.php" -exec php -d error_reporting=32767 -l {} \; 2>&1 >&- | grep "^"' - - 'vendor/bin/phpunit --colors ' \ No newline at end of file + - 'vendor/bin/phpunit --colors ' +# - phpdbg -qrr phpunit \ No newline at end of file diff --git a/phpunit.xml b/phpunit.xml index 55dcfd595..dd5e4b74d 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,4 +1,8 @@ - + ./tests/Install/ From 640f85a1b56b3b4525f8d4e2f3e6881afce483bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Sat, 5 Aug 2017 14:12:33 +0200 Subject: [PATCH 19/29] FIXED ENV --- phpunit.xml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/phpunit.xml b/phpunit.xml index dd5e4b74d..6a76f8696 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,9 +1,5 @@ - - + + ./tests/Install/ \ No newline at end of file From e8b87b757a2a6e8a62d67280b364e3bbb6d3933d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Sat, 5 Aug 2017 15:13:22 +0200 Subject: [PATCH 20/29] FIXED ENV --- .travis.yml | 6 +++++- tests/Install/InstallTest.php | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0895e7989..50121ca1f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,6 +15,7 @@ cache: env: global: + - DISPLAY=:99 - DB_HOST=localhost - DB_USER=travis - DB_PASSWORD=DB_NAME=2moons @@ -42,4 +43,7 @@ before_script: script: - 'vendor/bin/phpunit --colors ' -# - phpdbg -qrr phpunit \ No newline at end of file +# - phpdbg -qrr phpunit + +after_script: + - wget -O - -q -t 1 http://localhost:4444/selenium-server/driver/?cmd=shutDownSeleniumServer \ No newline at end of file diff --git a/tests/Install/InstallTest.php b/tests/Install/InstallTest.php index c688c14cd..fb28df671 100644 --- a/tests/Install/InstallTest.php +++ b/tests/Install/InstallTest.php @@ -4,13 +4,15 @@ class InstallTest extends PHPUnit_Extensions_Selenium2TestCase { protected function setUp() { + $this->setHost('localhost'); + $this->setPort(4444); $this->setBrowser('chrome'); $this->setBrowserUrl('http://localhost:8888/'); } public function testTitle() { - $this->url('http://localhost:8888/'); + $this->url('/'); $this->assertEquals('2Moons'); } } \ No newline at end of file From 692b72a63e3eb69b506b77b430d06b0a182a11f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Sat, 5 Aug 2017 15:18:26 +0200 Subject: [PATCH 21/29] FIXED ENV --- phpunit.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpunit.xml b/phpunit.xml index 6a76f8696..087895675 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,4 +1,4 @@ - + ./tests/Install/ From 9f258a6a0bf77136f99a0d7502ebab9985d28436 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Sat, 5 Aug 2017 17:38:51 +0200 Subject: [PATCH 22/29] Test w/ php http client --- .travis.yml | 14 +++----------- composer.json | 4 ++-- tests/Install/InstallTest.php | 20 ++++++++++++-------- 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/.travis.yml b/.travis.yml index 50121ca1f..1d0f92a87 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,16 +6,12 @@ language: php services: - mysql -addons: - chrome: stable - cache: directories: - $HOME/.composer/cache/files env: global: - - DISPLAY=:99 - DB_HOST=localhost - DB_USER=travis - DB_PASSWORD=DB_NAME=2moons @@ -30,7 +26,7 @@ matrix: fast_finish: true install: - - mysql -e 'CREATE DATABASE IF NOT EXISTS 2moons;' -uroot + - mysql -e 'CREATE DATABASE IF NOT EXISTS 2moons;' -uroot - composer install before_script: @@ -38,12 +34,8 @@ before_script: - '! find . ! -path "./includes/libs/*" ! -path "./vendor/*" -type f -name "*.php" -exec php -d error_reporting=32767 -l {} \; 2>&1 >&- | grep "^"' # Start a web server on port 8888, run in the background; wait for # initialization. - - nohup vendor/bin/selenium-server-standalone > /dev/null 2>&1 & - nohup php -S localhost:8888 > /dev/null 2>&1 & script: - - 'vendor/bin/phpunit --colors ' -# - phpdbg -qrr phpunit - -after_script: - - wget -O - -q -t 1 http://localhost:4444/selenium-server/driver/?cmd=shutDownSeleniumServer \ No newline at end of file + - 'vendor/bin/phpunit' +# - phpdbg -qrr phpunit \ No newline at end of file diff --git a/composer.json b/composer.json index 494cf5cbf..f3bad3c91 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "minimum-stability": "stable", "require": {}, "require-dev": { - "se/selenium-server-standalone": "~3.4", - "phpunit/phpunit-selenium": "~3" + "guzzlehttp/guzzle": "~6", + "phpunit/phpunit": "~6" } } diff --git a/tests/Install/InstallTest.php b/tests/Install/InstallTest.php index fb28df671..dda1f4297 100644 --- a/tests/Install/InstallTest.php +++ b/tests/Install/InstallTest.php @@ -1,18 +1,22 @@ setHost('localhost'); - $this->setPort(4444); - $this->setBrowser('chrome'); - $this->setBrowserUrl('http://localhost:8888/'); + $this->http = new GuzzleHttp\Client(['base_uri' => 'http://localhost:8888/']); + } + + public function tearDown() { + $this->http = null; } - public function testTitle() + public function testInstallRedirect() { - $this->url('/'); - $this->assertEquals('2Moons'); + $response = $this->http->request('GET', ''); + + $this->assertEquals(302, $response->getStatusCode()); } } \ No newline at end of file From bb0edfd9a4690e9067392d5b3ebafd2efccd5cfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Sat, 5 Aug 2017 17:55:35 +0200 Subject: [PATCH 23/29] Test w/ php http client --- .travis.yml | 1 + tests/Install/InstallTest.php | 28 +++++++++++++++++++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1d0f92a87..ce84a07a3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,7 @@ cache: env: global: + - TEST_BASE_URI=http://localhost:8888 - DB_HOST=localhost - DB_USER=travis - DB_PASSWORD=DB_NAME=2moons diff --git a/tests/Install/InstallTest.php b/tests/Install/InstallTest.php index dda1f4297..ab39aaf5b 100644 --- a/tests/Install/InstallTest.php +++ b/tests/Install/InstallTest.php @@ -1,12 +1,14 @@ http = new GuzzleHttp\Client(['base_uri' => 'http://localhost:8888/']); + $this->http = new GuzzleHttp\Client(['base_uri' => $_ENV['TEST_BASE_URI']]); } public function tearDown() { @@ -15,8 +17,28 @@ public function tearDown() { public function testInstallRedirect() { - $response = $this->http->request('GET', ''); + $response = $this->http->request('GET', '/', ['allow_redirects' => false]); $this->assertEquals(302, $response->getStatusCode()); + + $location = $response->getHeaders()["Location"][0]; + $this->assertEquals('install/index.php', $location); + } + + public function testInstallHome() + { + $response = $this->http->request('GET', '/install/index.php'); + + $this->assertEquals(200, $response->getStatusCode()); + } + + public function testInstallStep2() + { + $response = $this->http->request('GET', '/index.php?mode=install&step=2'); + + $this->assertEquals(200, $response->getStatusCode()); + + $this->assertRegexp('//', $response->getBody()); + $this->assertRegexp('//', $response->getBody()); } } \ No newline at end of file From a3940396ed03c11bce4fa365229da3fdb06551ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Sat, 5 Aug 2017 17:58:36 +0200 Subject: [PATCH 24/29] Test w/ php http client --- .travis.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index ce84a07a3..6e61239b6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,15 +1,13 @@ --- -dist: trusty sudo: false language: php - -services: - - mysql - cache: directories: - $HOME/.composer/cache/files +services: + - mysql + env: global: - TEST_BASE_URI=http://localhost:8888 @@ -39,4 +37,7 @@ before_script: script: - 'vendor/bin/phpunit' -# - phpdbg -qrr phpunit \ No newline at end of file +# - phpdbg -qrr phpunit + +notifications: + email: false \ No newline at end of file From 93150428860c95e56a7c29d5b36ca14b57e45b92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Sat, 5 Aug 2017 18:00:38 +0200 Subject: [PATCH 25/29] Test w/ php http client --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 6e61239b6..a3cf4db62 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,7 +33,7 @@ before_script: - '! find . ! -path "./includes/libs/*" ! -path "./vendor/*" -type f -name "*.php" -exec php -d error_reporting=32767 -l {} \; 2>&1 >&- | grep "^"' # Start a web server on port 8888, run in the background; wait for # initialization. - - nohup php -S localhost:8888 > /dev/null 2>&1 & + - nohup php -d variables_order=EGPCS -S localhost:8888 > /dev/null 2>&1 & script: - 'vendor/bin/phpunit' From e7e9b999c5b78e663df4e3adad5903161909de39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Sat, 5 Aug 2017 18:08:03 +0200 Subject: [PATCH 26/29] Test w/ php http client --- .travis.yml | 3 ++- tests/Install/InstallTest.php | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a3cf4db62..eb0243b64 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,8 @@ env: - TEST_BASE_URI=http://localhost:8888 - DB_HOST=localhost - DB_USER=travis - - DB_PASSWORD=DB_NAME=2moons + - DB_PASSWORD= + - DB_NAME=2moons - ADMIN_NAME=admin - ADMIN_PASSWORD=admin - ADMIN_MAIL=mail@example.com diff --git a/tests/Install/InstallTest.php b/tests/Install/InstallTest.php index ab39aaf5b..43a5cbaa6 100644 --- a/tests/Install/InstallTest.php +++ b/tests/Install/InstallTest.php @@ -41,4 +41,26 @@ public function testInstallStep2() $this->assertRegexp('//', $response->getBody()); $this->assertRegexp('//', $response->getBody()); } + + public function testInstallStep3() + { + $response = $this->http->request('GET', 'index.php?mode=install&step=3'); + + $this->assertEquals(200, $response->getStatusCode()); + } + + public function testInstallSql() + { + $response = $this->http->request('POST', 'index.php?mode=install&step=3', [ + 'form_params' => [ + 'host' => $_ENV['DB_USER'], + 'user' => $_ENV['DB_USER'], + 'passwort' => $_ENV['DB_PASSWORD'], + 'dbname' => $_ENV['DB_NAME'], + 'prefix' => '2moons_', + ] + ]); + + $this->assertEquals(200, $response->getStatusCode()); + } } \ No newline at end of file From 82509de0fe2068829a4f7258ca1f3c3cb765eb6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Sun, 6 Aug 2017 00:08:31 +0200 Subject: [PATCH 27/29] Test w/ php http client --- tests/Install/InstallTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/Install/InstallTest.php b/tests/Install/InstallTest.php index 43a5cbaa6..288a2e259 100644 --- a/tests/Install/InstallTest.php +++ b/tests/Install/InstallTest.php @@ -8,6 +8,7 @@ class InstallTest extends TestCase protected function setUp() { + var_dump($_SERVER,$_ENV,getenv('TEST_BASE_URI')); $this->http = new GuzzleHttp\Client(['base_uri' => $_ENV['TEST_BASE_URI']]); } From efd919df18b5fd9c76667f85f9f92f1dee2e9c12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Sun, 6 Aug 2017 00:12:35 +0200 Subject: [PATCH 28/29] Test w/ php http client --- tests/Install/InstallTest.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tests/Install/InstallTest.php b/tests/Install/InstallTest.php index 288a2e259..37a2ac774 100644 --- a/tests/Install/InstallTest.php +++ b/tests/Install/InstallTest.php @@ -8,8 +8,7 @@ class InstallTest extends TestCase protected function setUp() { - var_dump($_SERVER,$_ENV,getenv('TEST_BASE_URI')); - $this->http = new GuzzleHttp\Client(['base_uri' => $_ENV['TEST_BASE_URI']]); + $this->http = new GuzzleHttp\Client(['base_uri' => $_SERVER['TEST_BASE_URI']]); } public function tearDown() { @@ -54,10 +53,10 @@ public function testInstallSql() { $response = $this->http->request('POST', 'index.php?mode=install&step=3', [ 'form_params' => [ - 'host' => $_ENV['DB_USER'], - 'user' => $_ENV['DB_USER'], - 'passwort' => $_ENV['DB_PASSWORD'], - 'dbname' => $_ENV['DB_NAME'], + 'host' => $_SERVER['DB_USER'], + 'user' => $_SERVER['DB_USER'], + 'passwort' => $_SERVER['DB_PASSWORD'], + 'dbname' => $_SERVER['DB_NAME'], 'prefix' => '2moons_', ] ]); From c33d8074cd46a8e30934a7156707976adb029b88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Sun, 6 Aug 2017 00:17:50 +0200 Subject: [PATCH 29/29] Test w/ php http client --- .travis.yml | 2 +- tests/Install/InstallTest.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index eb0243b64..498e4556a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,7 @@ env: - TEST_BASE_URI=http://localhost:8888 - DB_HOST=localhost - DB_USER=travis - - DB_PASSWORD= + - DB_PASSWORD="" - DB_NAME=2moons - ADMIN_NAME=admin - ADMIN_PASSWORD=admin diff --git a/tests/Install/InstallTest.php b/tests/Install/InstallTest.php index 37a2ac774..8e057dbf0 100644 --- a/tests/Install/InstallTest.php +++ b/tests/Install/InstallTest.php @@ -22,7 +22,7 @@ public function testInstallRedirect() $this->assertEquals(302, $response->getStatusCode()); $location = $response->getHeaders()["Location"][0]; - $this->assertEquals('install/index.php', $location); + $this->assertRegexp('/install\/index.php/', $location); } public function testInstallHome() @@ -53,7 +53,7 @@ public function testInstallSql() { $response = $this->http->request('POST', 'index.php?mode=install&step=3', [ 'form_params' => [ - 'host' => $_SERVER['DB_USER'], + 'host' => $_SERVER['DB_HOST'], 'user' => $_SERVER['DB_USER'], 'passwort' => $_SERVER['DB_PASSWORD'], 'dbname' => $_SERVER['DB_NAME'],