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 6a450af + af21580 commit 97d06c6
Show file tree
Hide file tree
Showing 20 changed files with 303 additions and 657 deletions.
10 changes: 4 additions & 6 deletions .docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
FROM php:7.2-apache
FROM splitbrain/phpfarm:jessie

RUN apt-get update \
&& apt-get install -y libxml2-dev git zip zlib1g \
&& docker-php-ext-install soap
RUN apt-get update && apt-get install -y git zip

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

WORKDIR /var/www/html
WORKDIR /var/www/
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
vendor/
vendor
composer.lock
phpunit.xml
.phpunit.result.cache
33 changes: 23 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,21 +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

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

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
- 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.2.2
- Merged PR #9

Expand Down
25 changes: 20 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,27 @@ The `WsSecurity::createWsSecuritySoapHeader` parameters are defined in this orde
- **$usernameId**: the id to attach to the UsernameToken element, optional
- **$addNonce**: _true_ by default, if true, it adds the nonce element to the header, if false it does not add the nonce element to the header

## Unit tests
You can run the unit tests with the following command at the root directory of this project:
## 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
$ docker-compose up -d --build
```
$ composer test

You then have a container named `ws_security` 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 ws_security php-7.4 /usr/bin/composer update
# run tests in container
$ docker exec -it ws_security php-7.4 -dmemory_limit=-1 vendor/bin/phpunit
```

## Feedback
Any feedback is appreciated at [email protected] or by creating an issue on this project.
## FAQ

If you have a question, feel free to [create an issue](https://github.com/WsdlToPhp/WsSecurity/issues/new).

## License

The MIT License (MIT). Please see [License File](LICENSE) for more information.
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,17 @@
"email" : "[email protected]"
},
"require" : {
"php" : ">=5.4",
"ext-soap": "*"
"php" : ">=7.4",
"ext-soap": "*",
"ext-dom": "*"
},
"scripts": {
"test": "vendor/bin/phpunit",
"lint": "vendor/bin/php-cs-fixer fix --ansi --diff --verbose"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.0",
"phpunit/phpunit": "^4.8 || ^6.0"
"phpunit/phpunit": "^9"
},
"autoload" : {
"psr-4" : {
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ services:
context: .
dockerfile: .docker/Dockerfile
volumes:
- .:/var/www/html:rw
- .:/var/www:rw
container_name: ws_security
44 changes: 19 additions & 25 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,27 +1,21 @@
<?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>./src/resources</directory>
<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>./src/resources</directory>
<directory>./tests</directory>
<directory>./vendor</directory>
</exclude>
</coverage>
<testsuites>
<testsuite name="full">
<directory>./tests/</directory>
</testsuite>
</testsuites>
<php>
<ini name="error_reporting" value="-1"/>
</php>
</phpunit>
19 changes: 5 additions & 14 deletions src/Created.php
Original file line number Diff line number Diff line change
@@ -1,25 +1,16 @@
<?php

declare(strict_types=1);

namespace WsdlToPhp\WsSecurity;

class Created extends Element
{
/**
* Element name.
*
* @var string
*/
const NAME = 'Created';

/**
* Constructor for Created element.
*
* @param int $_timestamp the timestamp value
* @param string $_namespace the namespace
*/
public function __construct($_timestamp, $_namespace = self::NS_WSSU)
public function __construct(int $timestamp, string $namespace = self::NS_WSSU)
{
$this->setTimestampValue($_timestamp);
parent::__construct(self::NAME, $_namespace, $this->getTimestampValue(true));
$this->setTimestampValue($timestamp);
parent::__construct(self::NAME, $namespace, $this->getTimestampValue(true));
}
}
Loading

0 comments on commit 97d06c6

Please sign in to comment.