|
@@ 177-197 (lines=21) @@
|
| 174 |
|
/** |
| 175 |
|
* @test |
| 176 |
|
*/ |
| 177 |
|
public function shouldParseArrayOfObjects() |
| 178 |
|
{ |
| 179 |
|
//given |
| 180 |
|
$parameter = ParameterFactory::createParameterForArrayOfObjects('method'); |
| 181 |
|
|
| 182 |
|
//when |
| 183 |
|
$types = $this->_documentLiteralWrapped->typeParameters($parameter); |
| 184 |
|
|
| 185 |
|
//then |
| 186 |
|
$type = $types[0]; |
| 187 |
|
$this->assertEquals('method', $type->getName()); |
| 188 |
|
$this->assertEquals(array(array('type' => 'type', 'value' => 'ns:ArrayOfCompanies', 'name' => 'companies')), $type->getElementAttributes()); |
| 189 |
|
$actualContext = $type->getComplex(); |
| 190 |
|
Assert::thatArray($actualContext)->onMethod('getName')->containsExactly('ArrayOfCompanies'); |
| 191 |
|
Assert::thatArray($actualContext)->onMethod('getArrayType')->containsExactly('ns:Companies[]'); |
| 192 |
|
$this->assertEquals('Companies', $actualContext[0]->getComplex()->getName()); |
| 193 |
|
$this->assertEquals(array( |
| 194 |
|
array('type' => 'type', 'value' => 'xsd:string', 'name' => 'name'), |
| 195 |
|
array('type' => 'type', 'value' => 'xsd:int', 'name' => 'id') |
| 196 |
|
), $actualContext[0]->getComplex()->getElementAttributes()); |
| 197 |
|
} |
| 198 |
|
|
| 199 |
|
/** |
| 200 |
|
* @test |
|
@@ 335-354 (lines=20) @@
|
| 332 |
|
/** |
| 333 |
|
* @test |
| 334 |
|
*/ |
| 335 |
|
public function shouldParseReturnArrayOfObjects() |
| 336 |
|
{ |
| 337 |
|
//given |
| 338 |
|
$parameter = ParameterFactory::createReturnForArrayOfObjects('method'); |
| 339 |
|
|
| 340 |
|
//when |
| 341 |
|
$element = $this->_documentLiteralWrapped->typeReturning($parameter); |
| 342 |
|
|
| 343 |
|
//then |
| 344 |
|
$this->assertEquals('methodResponse', $element->getName()); |
| 345 |
|
$this->assertEquals(array(array('type' => 'type', 'value' => 'ns:ArrayOfCompanies', 'name' => 'companies')), $element->getElementAttributes()); |
| 346 |
|
$actualComplex = $element->getComplex(); |
| 347 |
|
Assert::thatArray($actualComplex)->onMethod('getName')->containsExactly('ArrayOfCompanies'); |
| 348 |
|
Assert::thatArray($actualComplex)->onMethod('getArrayType')->containsExactly('ns:Companies[]'); |
| 349 |
|
$this->assertEquals('Companies', $actualComplex[0]->getComplex()->getName()); |
| 350 |
|
$this->assertEquals(array( |
| 351 |
|
array('type' => 'type', 'value' => 'xsd:string', 'name' => 'name'), |
| 352 |
|
array('type' => 'type', 'value' => 'xsd:int', 'name' => 'id') |
| 353 |
|
), $actualComplex[0]->getComplex()->getElementAttributes()); |
| 354 |
|
} |
| 355 |
|
|
| 356 |
|
/** |
| 357 |
|
* @test |