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

Commit

Permalink
Restore default installed extensions/packages to ubuntu base (#445)
Browse files Browse the repository at this point in the history
* Restore default installed extensions/packages to ubuntu base

* Add test for installing via legacy php.ini method

* Fix legacy extensions test directory
  • Loading branch information
chingor13 authored May 31, 2018
1 parent edbeeb1 commit 77dff6f
Show file tree
Hide file tree
Showing 25 changed files with 584 additions and 21 deletions.
12 changes: 12 additions & 0 deletions cloudbuild-ubuntu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,18 @@ steps:
waitFor: ['php72-extensions-build']
id: php72-extensions-test

# php72-extensions-legacy test
- name: gcr.io/cloud-builders/docker
args: ['build', '-t', 'gcr.io/${_GOOGLE_PROJECT_ID}/php72-extensions:$_TAG', '.']
dir: testapps/php72_extensions_legacy
waitFor: ['php-onbuild']
id: php72-extensions-legacy-build
- name: gcr.io/cloud-builders/docker
args: ['run', 'gcr.io/${_GOOGLE_PROJECT_ID}/php72-extensions:$_TAG', 'vendor/bin/phpunit']
dir: testapps/php72_extensions_legacy
waitFor: ['php72-extensions-build']
id: php72-extensions-legacy-test

images:
- gcr.io/${_GOOGLE_PROJECT_ID}/ubuntu-php-base:$_TAG
- gcr.io/${_GOOGLE_PROJECT_ID}/ubuntu-php:$_TAG
Expand Down
1 change: 1 addition & 0 deletions testapps/php72_extensions_legacy/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Dockerfile
15 changes: 15 additions & 0 deletions testapps/php72_extensions_legacy/Dockerfile.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

FROM ${BASE_IMAGE}
44 changes: 44 additions & 0 deletions testapps/php72_extensions_legacy/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"require": {
"php": "7.2.*",
"phpunit/phpunit": "^4.8.35",
"ext-amqp": "*",
"ext-apm": "*",
"ext-bcmath": "*",
"ext-calendar": "*",
"ext-couchbase": "*",
"ext-ds": "*",
"ext-eio": "*",
"ext-exif": "*",
"ext-ftp": "*",
"ext-gd": "*",
"ext-gettext": "*",
"ext-hprose": "*",
"ext-intl": "*",
"ext-jsond": "*",
"ext-krb5": "*",
"ext-lua": "*",
"ext-lzf": "*",
"ext-memprof": "*",
"ext-pdo_sqlite": "*",
"ext-seaslog": "*",
"ext-shmop": "*",
"ext-soap": "*",
"ext-sqlite3": "*",
"ext-stomp": "*",
"ext-swoole": "*",
"ext-sync": "*",
"ext-tcpwrap": "*",
"ext-timezonedb": "*",
"ext-v8js": "*",
"ext-vips": "*",
"ext-yaconf": "*",
"ext-yaf": "*",
"ext-yaml": "*",
"ext-xmlrpc": "*",
"ext-xsl": "*",
"ext-bitset": "*",
"ext-igbinary": "*",
"ext-iconv": "*"
}
}
13 changes: 13 additions & 0 deletions testapps/php72_extensions_legacy/php.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
extension=cassandra.so
extension=ev.so
extension=event.so
extension=grpc.so
extension=imagick.so
extension=mongodb.so
extension=oauth.so
extension=opencensus.so
extension=pq.so
extension=protobuf.so
extension=rdkafka.so
extension=redis.so
extension=stackdriver_debugger.so
8 changes: 8 additions & 0 deletions testapps/php72_extensions_legacy/phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="./tests/bootstrap.php" colors="true">
<testsuites>
<testsuite>
<directory>tests</directory>
</testsuite>
</testsuites>
</phpunit>
Binary file added testapps/php72_extensions_legacy/tests/Blank300.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions testapps/php72_extensions_legacy/tests/CassandraTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php
/**
* Copyright 2017 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
use PHPUnit\Framework\TestCase;

class CassandraTest extends TestCase
{
private $success = false;

public function testExtensionLoaded()
{
$this->assertTrue(extension_loaded('cassandra'));
}
}
43 changes: 43 additions & 0 deletions testapps/php72_extensions_legacy/tests/EvTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php
/**
* Copyright 2017 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
use PHPUnit\Framework\TestCase;

class EvTest extends TestCase
{
private $success = false;

public function testExtensionLoaded()
{
$this->assertTrue(extension_loaded('ev'));
}

public function testTimer()
{
// after 5ms, update success
$w1 = new EvTimer(0.005, 0, function () {
$this->success = true;
});
Ev::run();

// sleep 10ms
usleep(10000);

Ev::stop();

$this->assertTrue($this->success);
}
}
27 changes: 27 additions & 0 deletions testapps/php72_extensions_legacy/tests/EventTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php
/**
* Copyright 2017 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
use PHPUnit\Framework\TestCase;

class EventTest extends TestCase
{
private $success = false;

public function testExtensionLoaded()
{
$this->assertTrue(extension_loaded('event'));
}
}
60 changes: 60 additions & 0 deletions testapps/php72_extensions_legacy/tests/ExtensionsLoadedTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?php
/**
* Copyright 2017 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
use PHPUnit\Framework\TestCase;

class ExtensionsLoadedTest extends TestCase
{
/**
* @dataProvider extensions
*/
public function testExtensionLoaded($extensionName)
{
$this->assertTrue(extension_loaded($extensionName));
}

public function extensions()
{
return [
['amqp'],
['apm'],
['bitset'],
['couchbase'],
['ds'],
['eio'],
['hprose'],
['igbinary'],
['jsond'],
['krb5'],
['lua'],
['lzf'],
['memprof'],
['opencensus'],
['seaslog'],
['stackdriver_debugger'],
['stomp'],
['swoole'],
['sync'],
['tcpwrap'],
['timezonedb'],
['v8js'],
['vips'],
['yaconf'],
['yaf'],
['yaml']
];
}
}
33 changes: 33 additions & 0 deletions testapps/php72_extensions_legacy/tests/GdTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php
/**
* Copyright 2017 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
use PHPUnit\Framework\TestCase;

class GdTest extends TestCase
{
public function testExtensionLoaded()
{
$this->assertTrue(extension_loaded('gd'));
}

public function testFreetypeSupport()
{
$this->assertTrue(
gd_info()['FreeType Support'],
'GD should support Freetype'
);
}
}
34 changes: 34 additions & 0 deletions testapps/php72_extensions_legacy/tests/GmpTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php
/**
* Copyright 2017 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
use PHPUnit\Framework\TestCase;

class GmpTest extends TestCase
{
public function testExtensionLoaded()
{
$this->assertTrue(extension_loaded('gmp'));
}

public function testGcd()
{
// basic test for greatest common denominator to see if gmp works
$this->assertEquals(
3,
gmp_intval(gmp_gcd("12", "21"))
);
}
}
35 changes: 35 additions & 0 deletions testapps/php72_extensions_legacy/tests/ImagickTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
/**
* Copyright 2017 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
use PHPUnit\Framework\TestCase;

class ImagickTest extends TestCase
{
private $success = false;

public function testExtensionLoaded()
{
$this->assertTrue(extension_loaded('imagick'));
}

public function testLoadImage()
{
$image = new Imagick(__DIR__ . '/Blank300.png');
$dimensions = $image->getImageGeometry();
$this->assertEquals(300, $dimensions['width']);
$this->assertEquals(1, $dimensions['height']);
}
}
Loading

0 comments on commit 77dff6f

Please sign in to comment.