Skip to content
This repository was archived by the owner on Oct 19, 2023. It is now read-only.

Commit 77dff6f

Browse files
authored
Restore default installed extensions/packages to ubuntu base (#445)
* Restore default installed extensions/packages to ubuntu base * Add test for installing via legacy php.ini method * Fix legacy extensions test directory
1 parent edbeeb1 commit 77dff6f

25 files changed

+584
-21
lines changed

cloudbuild-ubuntu.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,18 @@ steps:
262262
waitFor: ['php72-extensions-build']
263263
id: php72-extensions-test
264264

265+
# php72-extensions-legacy test
266+
- name: gcr.io/cloud-builders/docker
267+
args: ['build', '-t', 'gcr.io/${_GOOGLE_PROJECT_ID}/php72-extensions:$_TAG', '.']
268+
dir: testapps/php72_extensions_legacy
269+
waitFor: ['php-onbuild']
270+
id: php72-extensions-legacy-build
271+
- name: gcr.io/cloud-builders/docker
272+
args: ['run', 'gcr.io/${_GOOGLE_PROJECT_ID}/php72-extensions:$_TAG', 'vendor/bin/phpunit']
273+
dir: testapps/php72_extensions_legacy
274+
waitFor: ['php72-extensions-build']
275+
id: php72-extensions-legacy-test
276+
265277
images:
266278
- gcr.io/${_GOOGLE_PROJECT_ID}/ubuntu-php-base:$_TAG
267279
- gcr.io/${_GOOGLE_PROJECT_ID}/ubuntu-php:$_TAG
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Dockerfile
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright 2017 Google Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
FROM ${BASE_IMAGE}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"require": {
3+
"php": "7.2.*",
4+
"phpunit/phpunit": "^4.8.35",
5+
"ext-amqp": "*",
6+
"ext-apm": "*",
7+
"ext-bcmath": "*",
8+
"ext-calendar": "*",
9+
"ext-couchbase": "*",
10+
"ext-ds": "*",
11+
"ext-eio": "*",
12+
"ext-exif": "*",
13+
"ext-ftp": "*",
14+
"ext-gd": "*",
15+
"ext-gettext": "*",
16+
"ext-hprose": "*",
17+
"ext-intl": "*",
18+
"ext-jsond": "*",
19+
"ext-krb5": "*",
20+
"ext-lua": "*",
21+
"ext-lzf": "*",
22+
"ext-memprof": "*",
23+
"ext-pdo_sqlite": "*",
24+
"ext-seaslog": "*",
25+
"ext-shmop": "*",
26+
"ext-soap": "*",
27+
"ext-sqlite3": "*",
28+
"ext-stomp": "*",
29+
"ext-swoole": "*",
30+
"ext-sync": "*",
31+
"ext-tcpwrap": "*",
32+
"ext-timezonedb": "*",
33+
"ext-v8js": "*",
34+
"ext-vips": "*",
35+
"ext-yaconf": "*",
36+
"ext-yaf": "*",
37+
"ext-yaml": "*",
38+
"ext-xmlrpc": "*",
39+
"ext-xsl": "*",
40+
"ext-bitset": "*",
41+
"ext-igbinary": "*",
42+
"ext-iconv": "*"
43+
}
44+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
extension=cassandra.so
2+
extension=ev.so
3+
extension=event.so
4+
extension=grpc.so
5+
extension=imagick.so
6+
extension=mongodb.so
7+
extension=oauth.so
8+
extension=opencensus.so
9+
extension=pq.so
10+
extension=protobuf.so
11+
extension=rdkafka.so
12+
extension=redis.so
13+
extension=stackdriver_debugger.so
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit bootstrap="./tests/bootstrap.php" colors="true">
3+
<testsuites>
4+
<testsuite>
5+
<directory>tests</directory>
6+
</testsuite>
7+
</testsuites>
8+
</phpunit>
178 Bytes
Loading
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
/**
3+
* Copyright 2017 Google Inc.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
use PHPUnit\Framework\TestCase;
18+
19+
class CassandraTest extends TestCase
20+
{
21+
private $success = false;
22+
23+
public function testExtensionLoaded()
24+
{
25+
$this->assertTrue(extension_loaded('cassandra'));
26+
}
27+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
/**
3+
* Copyright 2017 Google Inc.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
use PHPUnit\Framework\TestCase;
18+
19+
class EvTest extends TestCase
20+
{
21+
private $success = false;
22+
23+
public function testExtensionLoaded()
24+
{
25+
$this->assertTrue(extension_loaded('ev'));
26+
}
27+
28+
public function testTimer()
29+
{
30+
// after 5ms, update success
31+
$w1 = new EvTimer(0.005, 0, function () {
32+
$this->success = true;
33+
});
34+
Ev::run();
35+
36+
// sleep 10ms
37+
usleep(10000);
38+
39+
Ev::stop();
40+
41+
$this->assertTrue($this->success);
42+
}
43+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
/**
3+
* Copyright 2017 Google Inc.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
use PHPUnit\Framework\TestCase;
18+
19+
class EventTest extends TestCase
20+
{
21+
private $success = false;
22+
23+
public function testExtensionLoaded()
24+
{
25+
$this->assertTrue(extension_loaded('event'));
26+
}
27+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<?php
2+
/**
3+
* Copyright 2017 Google Inc.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
use PHPUnit\Framework\TestCase;
18+
19+
class ExtensionsLoadedTest extends TestCase
20+
{
21+
/**
22+
* @dataProvider extensions
23+
*/
24+
public function testExtensionLoaded($extensionName)
25+
{
26+
$this->assertTrue(extension_loaded($extensionName));
27+
}
28+
29+
public function extensions()
30+
{
31+
return [
32+
['amqp'],
33+
['apm'],
34+
['bitset'],
35+
['couchbase'],
36+
['ds'],
37+
['eio'],
38+
['hprose'],
39+
['igbinary'],
40+
['jsond'],
41+
['krb5'],
42+
['lua'],
43+
['lzf'],
44+
['memprof'],
45+
['opencensus'],
46+
['seaslog'],
47+
['stackdriver_debugger'],
48+
['stomp'],
49+
['swoole'],
50+
['sync'],
51+
['tcpwrap'],
52+
['timezonedb'],
53+
['v8js'],
54+
['vips'],
55+
['yaconf'],
56+
['yaf'],
57+
['yaml']
58+
];
59+
}
60+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
/**
3+
* Copyright 2017 Google Inc.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
use PHPUnit\Framework\TestCase;
18+
19+
class GdTest extends TestCase
20+
{
21+
public function testExtensionLoaded()
22+
{
23+
$this->assertTrue(extension_loaded('gd'));
24+
}
25+
26+
public function testFreetypeSupport()
27+
{
28+
$this->assertTrue(
29+
gd_info()['FreeType Support'],
30+
'GD should support Freetype'
31+
);
32+
}
33+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
/**
3+
* Copyright 2017 Google Inc.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
use PHPUnit\Framework\TestCase;
18+
19+
class GmpTest extends TestCase
20+
{
21+
public function testExtensionLoaded()
22+
{
23+
$this->assertTrue(extension_loaded('gmp'));
24+
}
25+
26+
public function testGcd()
27+
{
28+
// basic test for greatest common denominator to see if gmp works
29+
$this->assertEquals(
30+
3,
31+
gmp_intval(gmp_gcd("12", "21"))
32+
);
33+
}
34+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
/**
3+
* Copyright 2017 Google Inc.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
use PHPUnit\Framework\TestCase;
18+
19+
class ImagickTest extends TestCase
20+
{
21+
private $success = false;
22+
23+
public function testExtensionLoaded()
24+
{
25+
$this->assertTrue(extension_loaded('imagick'));
26+
}
27+
28+
public function testLoadImage()
29+
{
30+
$image = new Imagick(__DIR__ . '/Blank300.png');
31+
$dimensions = $image->getImageGeometry();
32+
$this->assertEquals(300, $dimensions['width']);
33+
$this->assertEquals(1, $dimensions['height']);
34+
}
35+
}

0 commit comments

Comments
 (0)