| Conditions | 6 |
| Paths | 3 |
| Total Lines | 29 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 29 | public function add($attribute=null,$key=null,$value=null) |
||
| 30 | {
|
||
| 31 | $list = []; |
||
| 32 | |||
| 33 | //all add method parameters must come full. |
||
| 34 | if(!is_null($attribute) && !is_null($key) && !is_null($value)){
|
||
| 35 | |||
| 36 | // we do 0 key control for the testsuite data. |
||
| 37 | // this phpunit has a multiple test suite data if 0 key is present. |
||
| 38 | if(isset($this->data['testsuites']['testsuite'][0])){
|
||
| 39 | foreach ($this->data['testsuites']['testsuite'] as $key=>$item){
|
||
| 40 | $list[$key] = $item; |
||
| 41 | } |
||
| 42 | } |
||
| 43 | else{
|
||
| 44 | //only for a single test suite data |
||
| 45 | $list[] = $this->data['testsuites']['testsuite']; |
||
| 46 | } |
||
| 47 | |||
| 48 | // the data to be added is started with |
||
| 49 | // the number of pieces of the previous test suite. |
||
| 50 | $newKey = count($list); |
||
| 51 | |||
| 52 | //add new data |
||
| 53 | $list[$newKey]['@attributes']['name'] = $attribute; |
||
| 54 | $list[$newKey][$key] = $value; |
||
| 55 | } |
||
| 56 | |||
| 57 | return $list; |
||
| 58 | } |
||
| 59 | } |