/** * @covers sAdmin::sSaveRegisterShipping * @depends testsSaveRegisterMainData */ public function testsSaveRegisterShipping($userId) { $testData = array('company' => 'Testcompany', 'department' => 'Testdepartment', 'salutation' => 'Testsalutation', 'firstname' => 'Testfirstname', 'lastname' => 'Testlastname', 'street' => 'Teststreet', 'streetnumber' => 'Teststreetnumber', 'zipcode' => 'Testzipcode', 'city' => 'Testcity', 'country' => '2', 'stateID' => '3', 'text1' => 'text1', 'text2' => 'text2', 'text3' => 'text3', 'text4' => 'text4', 'text5' => 'text5', 'text6' => 'text6'); $result = $this->module->sSaveRegisterShipping($userId, array('shipping' => $testData)); $this->assertGreaterThan(0, $result); $savedData = Shopware()->Db()->fetchRow(' SELECT * FROM s_user_shippingaddress LEFT JOIN s_user_shippingaddress_attributes ON s_user_shippingaddress.id = s_user_shippingaddress_attributes.shippingID WHERE s_user_shippingaddress.id = ? ', array($result)); // Prepare demo data for comparison $testData['countryID'] = $testData['country']; unset($testData['country']); foreach ($testData as $name => $value) { $this->assertEquals($savedData[$name], $value); } Shopware()->Db()->delete('s_user_shippingaddress_attributes', 'shippingID = ' . $result); Shopware()->Db()->delete('s_user_shippingaddress', 'userID = ' . $userId); Shopware()->Db()->delete('s_user_attributes', 'userID = ' . $userId); Shopware()->Db()->delete('s_user', 'id = ' . $userId); }