You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The defined interfaces must be used in order to be able to match the requirements for the [PackageGenerator](https://github.com/WsdlToPhp/PackageGenerator) generated classes.
29
31
32
+
### StructEnumInterface
33
+
#### Description
34
+
This interface must be used to define a new EnumType class.
35
+
36
+
#### What has to be implemented?
37
+
There is at least/most one method that must be implemented so it's pretty fast to implement it even if you don't see the goal of it:
38
+
-**valueIsValid($value)**: this method must ensure that the passed `$value` is valid. This can be done using the array of string returned by the `getValidValues` method always present in the generated Enum classes.
39
+
40
+
**If you do not want to implement this method, you can too create your own class that inherits from our [AbstractStructEnumBase](#abstractstructenumbase) class.**
41
+
30
42
### StructInterface
31
43
#### Description
32
44
This interface must be used to define a new StructType class.
@@ -97,14 +109,24 @@ Here are the methods that must be implemented and why:
97
109
**If you do not want to implement all these methods, you can too create your own class that inherits from our [AbstractSoapClientBase](#abstractsoapclientbase) class.**
98
110
99
111
## The abstract classes
112
+
113
+
### AbstractStructEnumBase
114
+
#### Description
115
+
This class is the base class for any ```EnumType``` class generated by [PackageGenerator](https://github.com/WsdlToPhp/PackageGenerator). It implements our [StructEnumInterface](#structenuminterface) interface.
116
+
It defines two methods:
117
+
-**valueIsValid($value)**: It defines the default behaviour in order to validate a value that must be based on the current EnumType class constants returned by the `getValidValues` method.
118
+
-**__toString()**: see [__toString](http://php.net/manual/en/language.oop5.magic.php#object.tostring) definition
119
+
120
+
100
121
### AbstractStructBase
101
122
#### Description
102
123
This class is the base class for any ```StructType``` class generated by [PackageGenerator](https://github.com/WsdlToPhp/PackageGenerator). It implements our [StructInterface](#structinterface) interface.
103
-
It defines four methods:
124
+
It defines five methods:
104
125
-**__set_state($array)**: Useful when you load the string representation of an object that you stored using ```var_export```. It also allows you to ease the instanciation of an object that contains many properties which would be hard to instanciate using the ```__construct``` method. You can see ```__set_state``` as an hydratation method.
105
126
-**_set($name, $value)**: As magic method ```__set``` but used by the ```__set_state``` method. Plus, defining ```__set``` method on used class by the classmap option for the [SoapClient](http://php.net/manual/en/class.soapclient.php) breaks the correct hydratation of your received objects.
106
127
-**_get($name)**: As magic method ```__get```. Used by our [AbstractStructArrayBase](#abstractstructarraybase) class.
107
128
-**jsonSerialize()**: by implementing the [\JsonSerializable](http://php.net/manual/en/class.jsonserializable.php) interface, it implements this method that allows to pass the object to the [json_encode](http://php.net/manual/en/function.json-encode.php) method so it will return the properties of the current object in an array.
129
+
-**__toString()**: see [__toString](http://php.net/manual/en/language.oop5.magic.php#object.tostring) definition
108
130
109
131
#### Usage
110
132
```php
@@ -283,10 +305,33 @@ public function setSoapHeaderCSPCHD(\Api\StructType\ApiCSPCHD $cSPCHD, $nameSpac
283
305
## Need improvements for these classes?
284
306
Feel free to make some pull requests. We'll study them and let you know when it can be integrated.
285
307
286
-
## Unit tests
308
+
## Testing
287
309
You can run the unit tests with the following command:
288
310
```
289
-
$ cd /path/to/src/WsdlToPhp/PackageBase/
290
-
$ composer install
291
-
$ composer test
311
+
$ cd /path/to/src/WsdlToPhp/PackageBase/
312
+
$ composer install
313
+
$ composer test
314
+
```
315
+
316
+
## Testing using [Docker](https://www.docker.com/)
317
+
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:
318
+
- php-5.4
319
+
- php-5.5
320
+
- php-5.6
321
+
- php-7.0
322
+
- php-7.1
323
+
- php-7.2
324
+
- php-7.3
325
+
326
+
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:
327
+
```bash
328
+
$ docker-compose up -d --build
329
+
```
330
+
331
+
You then have a container named `package_base` in which you can run `composer` commands and `php cli` commands such as:
332
+
```bash
333
+
# install deps in container (using update ensure it does use the composer.lock file if there is any)
0 commit comments