Skip to content

Commit

Permalink
Merge branch 'release/2.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
mikaelcom committed Jan 26, 2021
2 parents ce19bd4 + e15a859 commit 41ab376
Show file tree
Hide file tree
Showing 25 changed files with 443 additions and 857 deletions.
17 changes: 5 additions & 12 deletions .docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
FROM php:7.2-apache AS dom_handler_php
FROM splitbrain/phpfarm:jessie

COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
COPY . /var/www/html

RUN apt-get update \
&& apt-get install -y zip git
RUN apt-get update && apt-get install -y git zip

ENV COMPOSER_ALLOW_SUPERUSER=1

WORKDIR /var/www/html
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
COPY . /var/www/

RUN composer self-update \
&& composer validate \
&& composer update --prefer-dist --no-scripts --no-progress --no-suggest
WORKDIR /var/www/
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
vendor/
vendor
composer.lock
phpunit.xml
.idea
.phpunit.result.cache
4 changes: 2 additions & 2 deletions .php_cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ $finder = PhpCsFixer\Finder::create()
->in(__DIR__);

return PhpCsFixer\Config::create()
->setUsingCache(false)
->setUsingCache(false)
->setRules(array(
'@PSR2' => true,
'binary_operator_spaces' => true,
'no_whitespace_in_blank_line' => true,
'ternary_operator_spaces' => true,
'cast_spaces' => true,
'trailing_comma_in_multiline_array' => true
))
))
->setFinder($finder);
42 changes: 23 additions & 19 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
language: php

sudo: false
jobs:
include:
- name: 'Tests under PHP 7.4'
php: '7.4'
dist: bionic
- name: 'Tests under PHP 8.0'
php: '8.0'
dist: bionic
- name: 'Tests under PHP nightly'
php: 'nightly'
dist: bionic

matrix:
include:
- php: 5.3
dist: precise

php:
- 5.4
- 5.5
- 5.6
- 7.0
- 7.1
- 7.2
fast_finish: true
allow_failures:
- php: 'nightly'

cache:
directories:
- $HOME/.composer/cache
directories:
- $HOME/.composer/cache

install:
- composer install
- composer install

script:
- ./vendor/phpunit/phpunit/phpunit --coverage-text --coverage-clover=coverage.clover
- php -dmemory_limit=-1 -dxdebug.mode=coverage ./vendor/phpunit/phpunit/phpunit --coverage-text --coverage-clover=coverage.clover

after_script:
- wget https://scrutinizer-ci.com/ocular.phar
- php ocular.phar code-coverage:upload --format=php-clover coverage.clover
- wget https://scrutinizer-ci.com/ocular.phar
- php -dmemory_limit=-1 ocular.phar code-coverage:upload --format=php-clover coverage.clover

after_success:
- bash <(curl -s https://codecov.io/bash)
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# CHANGELOG

## 2.0.0 - 2021/01/26
- use `splitbrain/phpfarm:jessie` as Docker image and fix docker image settings
- Code requires PHP >= 7.4
- Code cleaning
- Update README
- Update Travis CI settings
- Update PHPUnit settings
- Update LICENSE file
- Version 1.0 is no more maintained

## 1.0.1
- Initialize Docker settings
- pull request #1 - Update namespace in test classes to match the actual location
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2012-2018 Mikaël DELSOL
Copyright (c) 2012-2021 Mikaël DELSOL

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,29 @@
[![Build Status](https://travis-ci.org/WsdlToPhp/DomHandler.svg)](https://travis-ci.org/WsdlToPhp/DomHandler)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/WsdlToPhp/DomHandler/badges/quality-score.png)](https://scrutinizer-ci.com/g/WsdlToPhp/DomHandler/)
[![Code Coverage](https://scrutinizer-ci.com/g/WsdlToPhp/DomHandler/badges/coverage.png)](https://scrutinizer-ci.com/g/WsdlToPhp/DomHandler/)
[![Total Downloads](https://poser.pugx.org/wsdltophp/domhandler/downloads)](https://packagist.org/packages/wsdltophp/domhandler)
[![StyleCI](https://styleci.io/repos/87977980/shield)](https://styleci.io/repos/87977980)
[![SensioLabsInsight](https://insight.sensiolabs.com/projects/6bac01d7-5243-4682-9264-8166407c8a30/mini.png)](https://insight.sensiolabs.com/projects/6bac01d7-5243-4682-9264-8166407c8a30)

DomHandler uses the [decorator design pattern](https://en.wikipedia.org/wiki/Decorator_pattern) in order to ease DOM handling.

The source code has been originally created into the [PackageGenerator](https://github.com/WsdlToPhp/PackageGenerator) project but it felt that it had the possibility to live by itself and to evolve independtly from the PackageGenerator project if necessary.

## Testing
## Testing using [Docker](https://www.docker.com/)
Thanks to the [Docker image](https://hub.docker.com/r/splitbrain/phpfarm) of [phpfarm](https://github.com/fpoirotte/phpfarm), tests can be run locally under *any* PHP version using the cli:
- php-7.4

First of all, you need to create your container which you can do using [docker-compose](https://docs.docker.com/compose/) by running the below command line from the root directory of the project:
```bash
# composer test
$ docker-compose up -d --build
```

You then have a container named `dom_handler` in which you can run `composer` commands and `php cli` commands such as:
```bash
# install deps in container (using update ensure it does use the composer.lock file if there is any)
$ docker exec -it dom_handler php-7.4 /usr/bin/composer update
# run tests in container
$ docker exec -it dom_handler php-7.4 -dmemory_limit=-1 vendor/bin/phpunit
```

## Contributing
Expand Down
9 changes: 5 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@
}
],
"require": {
"php": ">=5.3.3"
"php": ">=7.4",
"ext-dom": "*"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "~2.0",
"phpunit/phpunit": "^4.8 || ^6.0"
"phpunit/phpunit": "^9"
},
"config": {
"sort-packages": true
Expand All @@ -43,8 +44,8 @@
}
},
"scripts": {
"lint": "vendor/bin/php-cs-fixer fix",
"test": "vendor/bin/phpunit"
"test": "vendor/bin/phpunit",
"lint": "vendor/bin/php-cs-fixer fix --ansi --diff --verbose"
},
"support": {
"email": "contact@wsdltophp.com"
Expand Down
15 changes: 7 additions & 8 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
version: '3.4'

services:
php:
build:
context: .
dockerfile: .docker/Dockerfile
target: dom_handler_php
volumes:
- .:/var/www/html:rw
container_name: dom_handler
php:
build:
context: .
dockerfile: .docker/Dockerfile
volumes:
- .:/var/www:rw
container_name: dom_handler
42 changes: 18 additions & 24 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,26 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="vendor/autoload.php">
<php>
<ini name="error_reporting" value="-1" />
</php>
<testsuites>
<testsuite name="full">
<directory>./tests</directory>
</testsuite>
</testsuites>

<filter>
<whitelist>
<directory>./</directory>
<exclude>
<directory>./tests</directory>
<directory>./vendor</directory>
</exclude>
</whitelist>
</filter>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" backupGlobals="false" colors="true" bootstrap="vendor/autoload.php">
<coverage>
<include>
<directory>./</directory>
</include>
<exclude>
<directory>./tests</directory>
<directory>./vendor</directory>
</exclude>
</coverage>
<php>
<ini name="error_reporting" value="-1"/>
</php>
<testsuites>
<testsuite name="full">
<directory>./tests</directory>
</testsuite>
</testsuites>
</phpunit>
Loading

0 comments on commit 41ab376

Please sign in to comment.