mirror of
https://github.com/e107inc/e107.git
synced 2025-03-31 02:32:37 +02:00
Added tests for e_shims
This commit is contained in:
parent
10a21270f4
commit
f145622207
@ -1,48 +0,0 @@
|
||||
# This file is a template, and might need editing before it works on your project.
|
||||
# Select image from https://hub.docker.com/_/php/
|
||||
image: php:apache
|
||||
|
||||
# Select what we should cache between builds
|
||||
cache:
|
||||
paths:
|
||||
- vendor/
|
||||
|
||||
before_script:
|
||||
- apt-get update -y
|
||||
- apt-get install -y git unzip #libmcrypt-dev libpq-dev libcurl4-gnutls-dev libicu-dev libvpx-dev libjpeg-dev libpng-dev libxpm-dev zlib1g-dev libfreetype6-dev libxml2-dev libexpat1-dev libbz2-dev libgmp3-dev libldap2-dev unixodbc-dev libsqlite3-dev libaspell-dev libsnmp-dev libpcre3-dev libtidy-dev
|
||||
## Install PHP extensions
|
||||
#- docker-php-ext-install mbstring mcrypt pdo_pgsql curl json intl gd xml zip bz2 opcache
|
||||
# Install & enable Xdebug for code coverage reports
|
||||
- pecl install xdebug
|
||||
- docker-php-ext-enable xdebug
|
||||
# Install and run Composer
|
||||
- curl -sS https://getcomposer.org/installer | php
|
||||
- php composer.phar install
|
||||
- git submodule update --init --recursive --remote
|
||||
#- yum install -y epel-release yum-utils
|
||||
#- yum install -y "http://rpms.remirepo.net/enterprise/remi-release-$(rpm -q --queryformat '%{VERSION}' centos-release).rpm"
|
||||
#- yum list -q 'php[0-9][0-9]' | awk '/php/ {print $1}' | xargs yum install -y
|
||||
#- yum install -y mariadb
|
||||
#- service mariadb restart
|
||||
#- yum install -y httpd
|
||||
#- sed -i 's/AllowOverride None/AllowOverride All/ig' /etc/httpd/conf/httpd.conf
|
||||
#- curl -sS https://getcomposer.org/installer | php
|
||||
#- php composer.phar install
|
||||
|
||||
# Bring in any services we need http://docs.gitlab.com/ee/ci/docker/using_docker_images.html#what-is-a-service
|
||||
# See http://docs.gitlab.com/ce/ci/services/README.html for examples.
|
||||
services:
|
||||
- mysql:5.7
|
||||
|
||||
# Set any variables we need
|
||||
variables:
|
||||
# Configure mysql environment variables (https://hub.docker.com/r/_/mysql/)
|
||||
MYSQL_DATABASE: mysql_database
|
||||
MYSQL_ROOT_PASSWORD: mysql_strong_password
|
||||
|
||||
# Run our tests
|
||||
# If Xdebug was installed you can generate a coverage report and see code coverage metrics.
|
||||
test:php7.0:
|
||||
image: php:7.0-apache
|
||||
script:
|
||||
- ./vendor/bin/codecept run --steps --debug --coverage --coverage-xml --coverage-html
|
2
e107
2
e107
@ -1 +1 @@
|
||||
Subproject commit 3b25fe86b6c8e44996b34775647e0275b99ba51f
|
||||
Subproject commit ee1a5b1278a4c6e47f93800d29b0b58504fd232c
|
35
tests/unit/e107/Shims/e_shimsTest.php
Normal file
35
tests/unit/e107/Shims/e_shimsTest.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2018 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
class e_shimsTest extends \Codeception\Test\Unit
|
||||
{
|
||||
public function testReadfile()
|
||||
{
|
||||
$this->testReadfileImplementation(array(e_shims::class, 'readfile'));
|
||||
}
|
||||
|
||||
public function testReadfileAlt()
|
||||
{
|
||||
$this->testReadfileImplementation(array(e_shims::class, 'readfile_alt'));
|
||||
}
|
||||
|
||||
private function testReadfileImplementation($implementation)
|
||||
{
|
||||
$tmp_handle = tmpfile();
|
||||
$tmp_filename = stream_get_meta_data($tmp_handle)['uri'];
|
||||
$garbage = str_pad('', 16384, 'x');
|
||||
fwrite($tmp_handle, $garbage);
|
||||
ob_start();
|
||||
call_user_func($implementation, $tmp_filename);
|
||||
$output = ob_get_clean();
|
||||
fclose($tmp_handle);
|
||||
$this->assertEquals($garbage, $output);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user