summaryrefslogtreecommitdiffstats
path: root/2800.patch
blob: 5bbec35466a7da5b6e3af9cec88eed3e111e75fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
From 599e1c7859ee1369b98d9ad825a26ca745e92810 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Thu, 21 Sep 2017 10:14:16 +0200
Subject: [PATCH 1/5] retrieve test server URI from environment

---
 tests/bootstrap.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/bootstrap.php b/tests/bootstrap.php
index a1793d32b3..cd8cc691a0 100644
--- a/tests/bootstrap.php
+++ b/tests/bootstrap.php
@@ -34,7 +34,7 @@
 
 define('GLPI_CONFIG_DIR', __DIR__);
 define('GLPI_LOG_DIR', __DIR__ . '/files/_log');
-define('GLPI_URI', 'http://localhost:8088');
+define('GLPI_URI', (getenv('GLPI_URI') ?: 'http://localhost:8088'));
 define('TU_USER', '_test_user');
 define('TU_PASS', 'PhpUnit_4');
 

From d3f2a000407a3f5066b89f5272359e97f49bca46 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Thu, 21 Sep 2017 10:26:21 +0200
Subject: [PATCH 2/5] fix test

---
 tests/units/NotificationEventAjax.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/units/NotificationEventAjax.php b/tests/units/NotificationEventAjax.php
index 814aae3deb..ef90f74f5e 100644
--- a/tests/units/NotificationEventAjax.php
+++ b/tests/units/NotificationEventAjax.php
@@ -167,7 +167,7 @@ public function testRaise() {
          'replytoname' => null,
          'headers' => '',
          'body_html' => null,
-         'body_text' => 'URL : http://localhost:8088/index.php?redirect=ticket_'.$ticket->getID().'&amp;noAUTO=1 
+         'body_text' => 'URL : ' . GLPI_URI . '/index.php?redirect=ticket_'.$ticket->getID().'&amp;noAUTO=1
 
 Ticket: Description
 

From 374d28644abed93766698ffa15036680c9d4dbfc Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Thu, 21 Sep 2017 10:30:18 +0200
Subject: [PATCH 3/5] fix test, relying on "vendor" is terribly bad...

---
 tests/units/Config.php | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/tests/units/Config.php b/tests/units/Config.php
index 16865fcd46..8cbb570fab 100644
--- a/tests/units/Config.php
+++ b/tests/units/Config.php
@@ -247,10 +247,12 @@ public function testGetLibraryDir() {
       $this->boolean(\Config::getLibraryDir('abcde'))->isFalse();
 
       $expected = realpath(__DIR__ . '/../../vendor/phpmailer/phpmailer');
-      $this->string(\Config::getLibraryDir('PHPMailer'))->isIdenticalTo($expected);
+      if (is_dir($expected)) { // skip when system library is used
+         $this->string(\Config::getLibraryDir('PHPMailer'))->isIdenticalTo($expected);
 
-      $mailer = new \PHPMailer();
-      $this->string(\Config::getLibraryDir($mailer))->isIdenticalTo($expected);
+         $mailer = new \PHPMailer();
+         $this->string(\Config::getLibraryDir($mailer))->isIdenticalTo($expected);
+      }
 
       $expected = realpath(__DIR__ . '/../');
       $this->string(\Config::getLibraryDir('getItemByTypeName'))->isIdenticalTo($expected);

From efcf895548cb06667376f1ef6bc473f1299e069d Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Thu, 21 Sep 2017 10:36:10 +0200
Subject: [PATCH 4/5] fix

---
 tests/units/NotificationEventAjax.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/units/NotificationEventAjax.php b/tests/units/NotificationEventAjax.php
index ef90f74f5e..da1dabc600 100644
--- a/tests/units/NotificationEventAjax.php
+++ b/tests/units/NotificationEventAjax.php
@@ -167,7 +167,7 @@ public function testRaise() {
          'replytoname' => null,
          'headers' => '',
          'body_html' => null,
-         'body_text' => 'URL : ' . GLPI_URI . '/index.php?redirect=ticket_'.$ticket->getID().'&amp;noAUTO=1
+         'body_text' => 'URL : ' . GLPI_URI . '/index.php?redirect=ticket_'.$ticket->getID().'&amp;noAUTO=1 
 
 Ticket: Description
 

From ae7b72cdcae66c063aee460d4939954a8988b66e Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Thu, 21 Sep 2017 10:54:33 +0200
Subject: [PATCH 5/5] create GLPI_SKIP_ONLINE

---
 tests/units/NotificationMailing.php | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tests/units/NotificationMailing.php b/tests/units/NotificationMailing.php
index 3373143371..3f488df840 100644
--- a/tests/units/NotificationMailing.php
+++ b/tests/units/NotificationMailing.php
@@ -44,8 +44,10 @@ public function testCheck() {
       $this->boolean($instance->check('user'))->isFalse();
       $this->boolean($instance->check('user@localhost'))->isTrue();
       $this->boolean($instance->check('user@localhost.dot'))->isTrue();
-      $this->boolean($instance->check('user@localhost.dot', ['checkdns' => true]))->isFalse();
-      $this->boolean($instance->check('user@glpi-project.org', ['checkdns' => true]))->isTrue();
+      if (!getenv('GLPI_SKIP_ONLINE')) {
+          $this->boolean($instance->check('user@localhost.dot', ['checkdns' => true]))->isFalse();
+          $this->boolean($instance->check('user@glpi-project.org', ['checkdns' => true]))->isTrue();
+      }
    }
 
    public function testSendNotification() {