From a3388622287e218beddfa14a47ed677d4307b36b Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Fri, 25 Mar 2016 17:55:51 +0100 Subject: Removed simpletest and moved all tests in the unit tree Tests are executed now, but a lot of them need fixing. --- tests/unit/Soap/SoapTest.php | 93 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 tests/unit/Soap/SoapTest.php (limited to 'tests/unit/Soap/SoapTest.php') diff --git a/tests/unit/Soap/SoapTest.php b/tests/unit/Soap/SoapTest.php new file mode 100644 index 00000000..6d4505d6 --- /dev/null +++ b/tests/unit/Soap/SoapTest.php @@ -0,0 +1,93 @@ +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