From a4e96b6caffd75d46d8751217049ab1988dcd5af Mon Sep 17 00:00:00 2001
From: Mindiell <mindiell@mindiell.net>
Date: Sun, 22 Jul 2018 21:56:01 +0200
Subject: [PATCH] Travail sur les tests

---
 .gitignore                              |  1 +
 tests/_support/AcceptanceTester.php     | 18 ++++++++++++++++++
 tests/acceptance.suite.yml              |  2 +-
 tests/acceptance/AddressCept.php        |  2 ++
 tests/acceptance/HomepageCept.php       |  6 ------
 tests/acceptance/HomepageCest.php       | 17 +++++++++++++++++
 tests/acceptance/PrivateProfileCept.php |  5 ++---
 tests/acceptance/visiting.feature       |  8 ++++++++
 8 files changed, 49 insertions(+), 10 deletions(-)
 delete mode 100644 tests/acceptance/HomepageCept.php
 create mode 100644 tests/acceptance/HomepageCest.php
 create mode 100644 tests/acceptance/visiting.feature

diff --git a/.gitignore b/.gitignore
index cb4dac7..36a7dd5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,5 +12,6 @@ phinx.yml
 app/env
 .php_cs.cache
 
+tests/_data
 tests/_output
 tests/_support/_generated
diff --git a/tests/_support/AcceptanceTester.php b/tests/_support/AcceptanceTester.php
index d0a09e3..3a1c9c3 100644
--- a/tests/_support/AcceptanceTester.php
+++ b/tests/_support/AcceptanceTester.php
@@ -35,4 +35,22 @@ class AcceptanceTester extends \Codeception\Actor
         $I->click('submit');
         $I->see('Se déconnecter', '.navbar');
     }
+
+    /**
+     * @Given I am on page :arg1
+     */
+     public function iAmOnPage($arg1)
+     {
+         $this->amOnPage($arg1);
+     }
+
+    /**
+     * @Then I should see :arg1
+     */
+     public function iShouldSee($arg1)
+     {
+         $this->see($arg1);
+     }
+
+
 }
diff --git a/tests/acceptance.suite.yml b/tests/acceptance.suite.yml
index bf79ae3..fc89ec3 100644
--- a/tests/acceptance.suite.yml
+++ b/tests/acceptance.suite.yml
@@ -8,5 +8,5 @@ class_name: AcceptanceTester
 modules:
     enabled:
         - PhpBrowser:
-            url: http://127.0.0.1:8000
+            url: http://don
         - \Helper\Acceptance
diff --git a/tests/acceptance/AddressCept.php b/tests/acceptance/AddressCept.php
index 5f64e37..a39998e 100644
--- a/tests/acceptance/AddressCept.php
+++ b/tests/acceptance/AddressCept.php
@@ -1,5 +1,6 @@
 <?php
 
+/*
 $I = new AcceptanceTester($scenario);
 $I->wantTo('Ensure that I can deal with addresses.');
 
@@ -46,3 +47,4 @@ $I->submitForm('form#up2', [
 $I->amOnPage('/perso');
 $I->dontSee('Second address', '#section-addresses');
 $I->see('New address name', '#section-addresses');
+*/
diff --git a/tests/acceptance/HomepageCept.php b/tests/acceptance/HomepageCept.php
deleted file mode 100644
index 9a353a7..0000000
--- a/tests/acceptance/HomepageCept.php
+++ /dev/null
@@ -1,6 +0,0 @@
-<?php
-
-$I = new AcceptanceTester($scenario);
-$I->wantTo('Ensure that homepage works.');
-$I->amOnPage('/');
-$I->see('Soutenez La Quadrature du Net !');
diff --git a/tests/acceptance/HomepageCest.php b/tests/acceptance/HomepageCest.php
new file mode 100644
index 0000000..87da9e0
--- /dev/null
+++ b/tests/acceptance/HomepageCest.php
@@ -0,0 +1,17 @@
+<?php
+class HomepageCest
+{
+    public function frontpageWorks(AcceptanceTester $I)
+    {
+        $I->wantTo('Ensure that homepage works.');
+        $I->amOnPage('/');
+        $I->see('Soutenez La Quadrature du Net !');
+    }
+
+    public function faqpageWorks(AcceptanceTester $I)
+    {
+        $I->wantTo('Ensure that FAQ works.');
+        $I->amOnPage('/faq');
+        $I->see('Foire aux questions');
+    }
+}
diff --git a/tests/acceptance/PrivateProfileCept.php b/tests/acceptance/PrivateProfileCept.php
index fd8ff2f..676fa31 100644
--- a/tests/acceptance/PrivateProfileCept.php
+++ b/tests/acceptance/PrivateProfileCept.php
@@ -1,12 +1,11 @@
 <?php
-
+/*
 $I = new AcceptanceTester($scenario);
 $I->wantTo('Ensure that private profile works.');
-
 $I->login('alice@example.org', 'password');
-
 // Check private profile
 $I->amOnPage('/perso');
 $I->see('Mes informations personnelles', 'h2');
 $I->see('Mes dons', 'h2');
 $I->see('Mes contreparties', 'h2');
+*/
diff --git a/tests/acceptance/visiting.feature b/tests/acceptance/visiting.feature
new file mode 100644
index 0000000..f58ccc9
--- /dev/null
+++ b/tests/acceptance/visiting.feature
@@ -0,0 +1,8 @@
+Feature: visiting
+  In order to visit the website
+  As an anonymous user
+  I need to see the Homepage
+
+  Scenario: Visiting the home page
+  Given I am on page "/"
+  Then I should see "Soutenez La Quadrature du Net"
-- 
GitLab