Esempio n. 1
0
 /**
  * testGetSoapVariablesWithOptions
  */
 public function testGetSoapVariablesWithOptions()
 {
     $firstChild = new ChildClass('Child 1', 7);
     $secondChild = new ChildClass('Child 2', 4);
     $thirdChild = new ChildClass('Child 3', 1);
     $parent = new ParentClass('Parent');
     $parent->addChildren($firstChild)->addChildren($secondChild)->addChildren($thirdChild);
     $parent->setEldestChild($firstChild);
     $lowerCaseFirst = true;
     $keepNullProperties = false;
     $soapVars = $this->soapClient->getSoapVariables($parent, $lowerCaseFirst, $keepNullProperties);
     $this->assertInternalType('array', $soapVars);
     $this->assertCount(1, $soapVars);
     $this->assertArrayHasKey('parentClass', $soapVars);
     $parentClassNode = $soapVars['parentClass'];
     $this->assertInternalType('array', $parentClassNode);
     $this->assertCount(3, $parentClassNode);
     $this->assertArrayHasKey('name', $parentClassNode);
     $this->assertArrayHasKey('children', $parentClassNode);
     $this->assertArrayHasKey('eldestChild', $parentClassNode);
     $this->assertArrayNotHasKey('nullAttribute', $parentClassNode);
     $this->assertEquals('Parent', $parentClassNode['name']);
     $childrenNode = $parentClassNode['children'];
     $eldestChildNode = $parentClassNode['eldestChild'];
     $this->assertInternalType('array', $childrenNode);
     $this->assertCount(3, $childrenNode);
     $firstChildNode = $childrenNode[0];
     $secondChildNode = $childrenNode[1];
     $thirdChildNode = $childrenNode[2];
     $this->assertInternalType('array', $firstChildNode);
     $this->assertCount(2, $firstChildNode);
     $this->assertEquals('Child 1', $firstChildNode['name']);
     $this->assertEquals('7', $firstChildNode['age']);
     $this->assertInternalType('string', $firstChildNode['age']);
     $this->assertInternalType('array', $secondChildNode);
     $this->assertCount(2, $secondChildNode);
     $this->assertEquals('Child 2', $secondChildNode['name']);
     $this->assertEquals('4', $secondChildNode['age']);
     $this->assertInternalType('string', $secondChildNode['age']);
     $this->assertInternalType('array', $thirdChildNode);
     $this->assertCount(2, $thirdChildNode);
     $this->assertEquals('Child 3', $thirdChildNode['name']);
     $this->assertEquals('1', $thirdChildNode['age']);
     $this->assertInternalType('string', $thirdChildNode['age']);
     $this->assertInternalType('array', $eldestChildNode);
     $this->assertCount(2, $eldestChildNode);
     $this->assertEquals('Child 1', $eldestChildNode['name']);
     $this->assertEquals('7', $eldestChildNode['age']);
     $this->assertInternalType('string', $eldestChildNode['age']);
 }