From 903ae8a581fac1e6917fc3e31d2ad8fb91df80c3 Mon Sep 17 00:00:00 2001 From: ctrlaltca <> Date: Thu, 12 Jul 2012 11:21:01 +0000 Subject: standardize the use of unix eol; use svn properties to enforce native eol --- tests/simple_unit/Soap/ContactManager.php | 312 +++++++++++++++--------------- tests/simple_unit/Soap/SoapTestCase.php | 182 ++++++++--------- 2 files changed, 247 insertions(+), 247 deletions(-) (limited to 'tests/simple_unit/Soap') diff --git a/tests/simple_unit/Soap/ContactManager.php b/tests/simple_unit/Soap/ContactManager.php index 8bf3d756..290063b3 100644 --- a/tests/simple_unit/Soap/ContactManager.php +++ b/tests/simple_unit/Soap/ContactManager.php @@ -1,157 +1,157 @@ -address = new Address(); - $Contact->address->city ="sesamcity"; - $Contact->address->street ="sesamstreet"; - $Contact->email = "me@you.com"; - $Contact->id = 1; - $Contact->name ="me"; - - $ret[] = $Contact; - //debugObject("Contacten: ",$ret); - return $ret; - } - - /** - * Gets the Contact with the given id. - * @param int $id The id - * @return Contact - * @soapmethod - */ - public function getContact($id) { - //get Contact from db - //might wanna throw an exception when it does not exists - throw new Exception("Contact '$id' not found"); - } - /** - * Generates an new, empty Contact template - * @return Contact - * @soapmethod - */ - public function newContact() { - return new Contact(); - } - - /** - * Saves a given Contact - * @param Contact $Contact - * @return boolean - * @soapmethod - */ - public function saveContact(Contact $Contact) { - //error_log(var_export($Contact,true)); - //$Contact->save(); - return true; - } - - /** - * @return mixed - * @soapmethod - */ - public function getList() - { - return array(array(1,2), array("12", 1.2)); - } - - /** - * @return array - * @soapmethod - */ - public function getEmptyArray() - { - return array(); - } - -} - - -/** - * The Contact details for a person - * - * Stores the person's name, address and e-mail - * This class is for example purposes only, just to - * show how to create a webservice - * - */ -class Contact{ - - /** - * @var int $id - * @soapproperty - */ - public $id; - - /** - * @var string $name - * @soapproperty - */ - public $name; - - /** @var Address $address - * @soapproperty - */ - public $address; - - /** @var string $email - * @soapproperty - */ - public $email; - - /** - * saves a Contact - * - * @return void - */ - public function save() { - //save Contact 2 db - } -} - -/** - * Stores an address - * - * An address consists of a street, number, zipcode and city. - * This class is for example purposes only, just to - * show how to create a webservice - * - */ -class Address{ - /** @var string $street - * @soapproperty - */ - public $street; - - /** @var string $nr - * @soapproperty - */ - public $nr; - - /** @var string $zipcode - * @soapproperty - */ - public $zipcode; - - /** @var string $city - * @soapproperty - */ - public $city; -} - +address = new Address(); + $Contact->address->city ="sesamcity"; + $Contact->address->street ="sesamstreet"; + $Contact->email = "me@you.com"; + $Contact->id = 1; + $Contact->name ="me"; + + $ret[] = $Contact; + //debugObject("Contacten: ",$ret); + return $ret; + } + + /** + * Gets the Contact with the given id. + * @param int $id The id + * @return Contact + * @soapmethod + */ + public function getContact($id) { + //get Contact from db + //might wanna throw an exception when it does not exists + throw new Exception("Contact '$id' not found"); + } + /** + * Generates an new, empty Contact template + * @return Contact + * @soapmethod + */ + public function newContact() { + return new Contact(); + } + + /** + * Saves a given Contact + * @param Contact $Contact + * @return boolean + * @soapmethod + */ + public function saveContact(Contact $Contact) { + //error_log(var_export($Contact,true)); + //$Contact->save(); + return true; + } + + /** + * @return mixed + * @soapmethod + */ + public function getList() + { + return array(array(1,2), array("12", 1.2)); + } + + /** + * @return array + * @soapmethod + */ + public function getEmptyArray() + { + return array(); + } + +} + + +/** + * The Contact details for a person + * + * Stores the person's name, address and e-mail + * This class is for example purposes only, just to + * show how to create a webservice + * + */ +class Contact{ + + /** + * @var int $id + * @soapproperty + */ + public $id; + + /** + * @var string $name + * @soapproperty + */ + public $name; + + /** @var Address $address + * @soapproperty + */ + public $address; + + /** @var string $email + * @soapproperty + */ + public $email; + + /** + * saves a Contact + * + * @return void + */ + public function save() { + //save Contact 2 db + } +} + +/** + * Stores an address + * + * An address consists of a street, number, zipcode and city. + * This class is for example purposes only, just to + * show how to create a webservice + * + */ +class Address{ + /** @var string $street + * @soapproperty + */ + public $street; + + /** @var string $nr + * @soapproperty + */ + public $nr; + + /** @var string $zipcode + * @soapproperty + */ + public $zipcode; + + /** @var string $city + * @soapproperty + */ + public $city; +} + ?> \ No newline at end of file diff --git a/tests/simple_unit/Soap/SoapTestCase.php b/tests/simple_unit/Soap/SoapTestCase.php index d297ce41..fe151b04 100644 --- a/tests/simple_unit/Soap/SoapTestCase.php +++ b/tests/simple_unit/Soap/SoapTestCase.php @@ -1,91 +1,91 @@ -getWsdlUri()); - } - - function testContactArray() - { - $result = $this->getClient()->getContacts(); - $this->assertEqual(count($result), 1); - $obj = $result->Contact; - $this->assertEqual($obj->name, "me"); - $this->assertEqual($obj->id, 1); - $this->assertEqual($obj->address->street, "sesamstreet"); - $this->assertNull($obj->address->nr); - $this->assertNull($obj->address->zipcode); - $this->assertEqual($obj->address->city, "sesamcity"); - $this->assertEqual($obj->email, "me@you.com"); - } - - function testGetContactThrowsException() - { - try - { - $result = $this->getClient()->getContact(1); - $this->fail(); - } - catch (SoapFault $f) - { - $this->pass(); - } - } - - function testGetNewContact() - { - $obj = $this->getClient()->newContact(); - $this->assertNull($obj->name); - $this->assertNull($obj->id); - $this->assertNull($obj->address); - $this->assertNull($obj->email); - } - - function testSaveContactReturnsTrue() - { - $c = new Contact; - $result = $this->getClient()->saveContact($c); - $this->assertTrue($result); - } - - function getMixedArray() - { - $result = $this->getClient()>getList(); - $expected = array(array(1,2), array("12", 1.2)); - $this->assertEqual($result, $expected); - } - - function testEmptyArray() - { - $result = $this->getClient()->getEmptyArray(); - $this->assertTrue(is_array($result)); - $this->assertEqual(count($result), 0); - } - - function testUnknownFunctionThrowsException() - { - try - { - $this->getClient()->test(); - $this->fail(); - } - catch (SoapFault $f) - { - $this->pass(); - } - } -} - -?> +getWsdlUri()); + } + + function testContactArray() + { + $result = $this->getClient()->getContacts(); + $this->assertEqual(count($result), 1); + $obj = $result->Contact; + $this->assertEqual($obj->name, "me"); + $this->assertEqual($obj->id, 1); + $this->assertEqual($obj->address->street, "sesamstreet"); + $this->assertNull($obj->address->nr); + $this->assertNull($obj->address->zipcode); + $this->assertEqual($obj->address->city, "sesamcity"); + $this->assertEqual($obj->email, "me@you.com"); + } + + function testGetContactThrowsException() + { + try + { + $result = $this->getClient()->getContact(1); + $this->fail(); + } + catch (SoapFault $f) + { + $this->pass(); + } + } + + function testGetNewContact() + { + $obj = $this->getClient()->newContact(); + $this->assertNull($obj->name); + $this->assertNull($obj->id); + $this->assertNull($obj->address); + $this->assertNull($obj->email); + } + + function testSaveContactReturnsTrue() + { + $c = new Contact; + $result = $this->getClient()->saveContact($c); + $this->assertTrue($result); + } + + function getMixedArray() + { + $result = $this->getClient()>getList(); + $expected = array(array(1,2), array("12", 1.2)); + $this->assertEqual($result, $expected); + } + + function testEmptyArray() + { + $result = $this->getClient()->getEmptyArray(); + $this->assertTrue(is_array($result)); + $this->assertEqual(count($result), 0); + } + + function testUnknownFunctionThrowsException() + { + try + { + $this->getClient()->test(); + $this->fail(); + } + catch (SoapFault $f) + { + $this->pass(); + } + } +} + +?> -- cgit v1.2.3