-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
303 additions
and
657 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
vendor/ | ||
vendor | ||
composer.lock | ||
phpunit.xml | ||
.phpunit.result.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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" : { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); | ||
} | ||
} |
Oops, something went wrong.