Skip to content

Commit e02ea45

Browse files
committed
Add PHP 8.0 and 8.1 testing to bitbucket pipeline. Adjust version for PHPUnit in composer (9.5 > ^9.5).
1 parent db8258d commit e02ea45

5 files changed

Lines changed: 52 additions & 30 deletions

File tree

bitbucket-pipelines.yml

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,31 @@
1-
image: php:7.4
2-
31
pipelines:
42
default:
53
- parallel:
64
- step:
7-
name: Test
5+
name: PHP 7.4
6+
image: php:7.4
7+
script:
8+
- apt-get update && apt-get install -qy git curl libzip-dev zip
9+
- docker-php-ext-install zip
10+
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
11+
- composer install --ignore-platform-reqs
12+
- ./vendor/bin/phpunit tests
13+
caches:
14+
- composer
15+
- step:
16+
name: PHP 8.0
17+
image: php:8.0
18+
script:
19+
- apt-get update && apt-get install -qy git curl libzip-dev zip
20+
- docker-php-ext-install zip
21+
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
22+
- composer install --ignore-platform-reqs
23+
- ./vendor/bin/phpunit tests
24+
caches:
25+
- composer
26+
- step:
27+
name: PHP 8.1
28+
image: php:8.1
829
script:
930
- apt-get update && apt-get install -qy git curl libzip-dev zip
1031
- docker-php-ext-install zip

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "The firewall engine of Patchstack.",
44
"type": "library",
55
"require": {
6-
"php": ">=5.4",
6+
"php": ">=5.6",
77
"opis/closure": "^3.6",
88
"laravel/serializable-closure": "^1.1"
99
},
@@ -20,6 +20,6 @@
2020
}
2121
],
2222
"require-dev": {
23-
"phpunit/phpunit": "9.5"
23+
"phpunit/phpunit": "^9.5"
2424
}
2525
}

composer.lock

Lines changed: 20 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/FirewallDatasetTest.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,13 @@ class_alias('\Laravel\SerializableClosure\SerializableClosure', 'SerializeClosur
9494
return in_array($_SERVER['REMOTE_ADDR'], $datasets['ps_ips']);
9595
};
9696
$wrapper = new SerializeClosure($function);
97+
$serialized = base64_encode(serialize($wrapper));
9798
$rule = (object) [
9899
'id' => 1,
99100
'title' => 'Determine if IP is in blacklist',
100101
'rule_closure' => (object) [
101-
'opis' => base64_encode(serialize($wrapper)),
102-
'laravel' => base64_encode(serialize($wrapper))
102+
'opis' => $serialized,
103+
'laravel' => $serialized
103104
],
104105
'cat' => 'TEST',
105106
'type' => 'BLOCK'
@@ -116,12 +117,13 @@ class_alias('\Laravel\SerializableClosure\SerializableClosure', 'SerializeClosur
116117
return preg_match($datasets['ps_sqli'], $_GET['id']) === 1;
117118
};
118119
$wrapper = new SerializeClosure($function);
120+
$serialized = base64_encode(serialize($wrapper));
119121
$rule = (object) [
120122
'id' => 1,
121123
'title' => 'Determine if union all select regex is a hit in the id GET parameter',
122124
'rule_closure' => (object) [
123-
'opis' => base64_encode(serialize($wrapper)),
124-
'laravel' => base64_encode(serialize($wrapper))
125+
'opis' => $serialized,
126+
'laravel' => $serialized
125127
],
126128
'cat' => 'TEST',
127129
'type' => 'BLOCK'

tests/WhitelistTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ protected function setUp(): void
2727
{
2828
$this->rules = json_decode(file_get_contents(dirname(__FILE__) . '/data/Rules.json'));
2929
$this->whitelist = json_decode(file_get_contents(dirname(__FILE__) . '/data/Whitelist.json'));
30-
3130
$this->processor = new Processor(
3231
new Extension(),
3332
$this->rules,

0 commit comments

Comments
 (0)