@@ -28,11 +28,13 @@ describe('Features tests', () => {
28
28
'Install-PhpExtension pcov -MinimumStability alpha'
29
29
) ;
30
30
31
- win32 = await features . addExtension ( 'DoesNotExist' , '7.2' , 'win32' ) ;
32
- expect ( win32 ) . not . toContain (
33
- 'Install-PhpExtension DoesNotExist -MinimumStability stable'
34
- ) ;
31
+ win32 = await features . addExtension ( 'does_not_exist' , '7.2' , 'win32' ) ;
32
+ expect ( win32 ) . toContain ( 'Could not find extension: does_not_exist' ) ;
33
+
34
+ win32 = await features . addExtension ( 'xdebug' , '7.2' , 'fedora' ) ;
35
+ expect ( win32 ) . toContain ( 'Platform fedora is not supported' ) ;
35
36
} ) ;
37
+
36
38
it ( 'checking addExtensionOnLinux' , async ( ) => {
37
39
let linux : string = await features . addExtension (
38
40
'xdebug, pcov' ,
@@ -45,7 +47,11 @@ describe('Features tests', () => {
45
47
expect ( linux ) . toContain (
46
48
'sudo DEBIAN_FRONTEND=noninteractive apt install -y php7.2-pcov'
47
49
) ;
50
+
51
+ linux = await features . addExtension ( 'xdebug' , '7.2' , 'fedora' ) ;
52
+ expect ( linux ) . toContain ( 'Platform fedora is not supported' ) ;
48
53
} ) ;
54
+
49
55
it ( 'checking addExtensionOnDarwin' , async ( ) => {
50
56
let darwin : string = await features . addExtension (
51
57
'xdebug, pcov' ,
@@ -55,8 +61,14 @@ describe('Features tests', () => {
55
61
expect ( darwin ) . toContain ( 'sudo pecl install xdebug' ) ;
56
62
expect ( darwin ) . toContain ( 'sudo pecl install pcov' ) ;
57
63
58
- darwin = await features . addExtension ( 'DoesNotExist' , '7.2' , 'darwin' ) ;
59
- expect ( darwin ) . not . toContain ( 'sudo pecl install DoesNotExist' ) ;
64
+ darwin = await features . addExtension ( 'xdebug' , '5.6' , 'darwin' ) ;
65
+ expect ( darwin ) . toContain ( 'sudo pecl install xdebug-2.5.5' ) ;
66
+
67
+ darwin = await features . addExtension ( 'does_not_exist' , '7.2' , 'darwin' ) ;
68
+ expect ( darwin ) . toContain ( 'Could not find extension: does_not_exist' ) ;
69
+
70
+ darwin = await features . addExtension ( 'xdebug' , '7.2' , 'fedora' ) ;
71
+ expect ( darwin ) . toContain ( 'Platform fedora is not supported' ) ;
60
72
} ) ;
61
73
62
74
it ( 'checking addINIValuesOnWindows' , async ( ) => {
@@ -73,6 +85,12 @@ describe('Features tests', () => {
73
85
expect ( win32 ) . toContain (
74
86
'Add-Content C:\\tools\\php\\php.ini "date.timezone=Asia/Kolkata"'
75
87
) ;
88
+
89
+ win32 = await features . addINIValues (
90
+ 'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata' ,
91
+ 'fedora'
92
+ ) ;
93
+ expect ( win32 ) . toContain ( 'Platform fedora is not supported' ) ;
76
94
} ) ;
77
95
78
96
it ( 'checking addINIValuesOnLinux' , async ( ) => {
@@ -83,6 +101,12 @@ describe('Features tests', () => {
83
101
expect ( linux ) . toContain ( 'echo "post_max_size=256M" >> $ini_file' ) ;
84
102
expect ( linux ) . toContain ( 'echo "short_open_tag=On" >> $ini_file' ) ;
85
103
expect ( linux ) . toContain ( 'echo "date.timezone=Asia/Kolkata" >> $ini_file' ) ;
104
+
105
+ linux = await features . addINIValues (
106
+ 'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata' ,
107
+ 'fedora'
108
+ ) ;
109
+ expect ( linux ) . toContain ( 'Platform fedora is not supported' ) ;
86
110
} ) ;
87
111
88
112
it ( 'checking addINIValuesOnDarwin' , async ( ) => {
@@ -93,5 +117,85 @@ describe('Features tests', () => {
93
117
expect ( darwin ) . toContain ( 'echo "post_max_size=256M" >> $ini_file' ) ;
94
118
expect ( darwin ) . toContain ( 'echo "short_open_tag=On" >> $ini_file' ) ;
95
119
expect ( darwin ) . toContain ( 'echo "date.timezone=Asia/Kolkata" >> $ini_file' ) ;
120
+
121
+ darwin = await features . addINIValues (
122
+ 'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata' ,
123
+ 'fedora'
124
+ ) ;
125
+ expect ( darwin ) . toContain ( 'Platform fedora is not supported' ) ;
126
+ } ) ;
127
+
128
+ it ( 'checking addCoverage on windows' , async ( ) => {
129
+ let win32 : string = await features . addCoverage ( 'xdebug' , '7.4' , 'win32' ) ;
130
+ expect ( win32 ) . toContain (
131
+ 'Install-PhpExtension xdebug -MinimumStability alpha'
132
+ ) ;
133
+
134
+ win32 = await features . addCoverage ( 'xdebug' , '7.3' , 'win32' ) ;
135
+ expect ( win32 ) . toContain (
136
+ 'Install-PhpExtension xdebug -MinimumStability stable'
137
+ ) ;
138
+
139
+ win32 = await features . addCoverage ( 'pcov' , '7.4' , 'win32' ) ;
140
+ expect ( win32 ) . toContain (
141
+ 'Install-PhpExtension pcov -MinimumStability alpha'
142
+ ) ;
143
+ expect ( win32 ) . toContain (
144
+ 'if(php -m | findstr -i xdebug) { Disable-PhpExtension xdebug C:\\tools\\php'
145
+ ) ;
146
+
147
+ win32 = await features . addCoverage ( 'pcov' , '7.3' , 'win32' ) ;
148
+ expect ( win32 ) . toContain (
149
+ 'Install-PhpExtension pcov -MinimumStability stable'
150
+ ) ;
151
+ expect ( win32 ) . toContain (
152
+ 'if(php -m | findstr -i xdebug) { Disable-PhpExtension xdebug C:\\tools\\php'
153
+ ) ;
154
+
155
+ win32 = await features . addCoverage ( 'nocov' , '7.3' , 'win32' ) ;
156
+ expect ( win32 ) . toContain ( '' ) ;
157
+
158
+ win32 = await features . addCoverage ( 'pcov' , '7.0' , 'win32' ) ;
159
+ expect ( win32 ) . toContain ( 'pcov requires php 7.1 or newer' ) ;
160
+
161
+ win32 = await features . addCoverage ( 'pcov' , '5.6' , 'win32' ) ;
162
+ expect ( win32 ) . toContain ( 'pcov requires php 7.1 or newer' ) ;
163
+
164
+ win32 = await features . addCoverage ( '' , '7.4' , 'win32' ) ;
165
+ expect ( win32 ) . toEqual ( '' ) ;
166
+ } ) ;
167
+
168
+ it ( 'checking addCoverage on linux' , async ( ) => {
169
+ let linux : string = await features . addCoverage ( 'xdebug' , '7.4' , 'linux' ) ;
170
+ expect ( linux ) . toContain (
171
+ 'sudo DEBIAN_FRONTEND=noninteractive apt install -y php7.4-xdebug'
172
+ ) ;
173
+
174
+ linux = await features . addCoverage ( 'pcov' , '7.4' , 'linux' ) ;
175
+ expect ( linux ) . toContain (
176
+ 'sudo DEBIAN_FRONTEND=noninteractive apt install -y php7.4-pcov'
177
+ ) ;
178
+ expect ( linux ) . toContain (
179
+ "sudo phpdismod xdebug || echo 'xdebug not installed'"
180
+ ) ;
181
+ expect ( linux ) . toContain ( "sudo phpenmod pcov || echo 'pcov not installed'" ) ;
182
+
183
+ linux = await features . addCoverage ( '' , '7.4' , 'linux' ) ;
184
+ expect ( linux ) . toEqual ( '' ) ;
185
+ } ) ;
186
+
187
+ it ( 'checking addCoverage on darwin' , async ( ) => {
188
+ let darwin : string = await features . addCoverage ( 'xdebug' , '7.4' , 'darwin' ) ;
189
+ expect ( darwin ) . toContain ( 'sudo pecl install xdebug' ) ;
190
+
191
+ darwin = await features . addCoverage ( 'xdebug' , '5.6' , 'darwin' ) ;
192
+ expect ( darwin ) . toContain ( 'sudo pecl install xdebug-2.5.5' ) ;
193
+
194
+ darwin = await features . addCoverage ( 'pcov' , '7.4' , 'darwin' ) ;
195
+ expect ( darwin ) . toContain ( 'sudo pecl install pcov' ) ;
196
+ expect ( darwin ) . toContain ( 'sudo sed -i \'\' "/xdebug/d" $ini_file\n' ) ;
197
+
198
+ darwin = await features . addCoverage ( '' , '7.4' , 'win32' ) ;
199
+ expect ( darwin ) . toEqual ( '' ) ;
96
200
} ) ;
97
201
} ) ;
0 commit comments