/** * @covers sAdmin::sSaveRegisterBilling * @depends testsSaveRegisterMainData */ public function testsSaveRegisterBilling($userId) { $testData = array('company' => 'Testcompany', 'department' => 'Testdepartment', 'salutation' => 'Testsalutation', 'firstname' => 'Testfirstname', 'lastname' => 'Testlastname', 'street' => 'Teststreet', 'streetnumber' => 'Teststreetnumber', 'zipcode' => 'Testzipcode', 'city' => 'Testcity', 'phone' => 'Testphone', 'fax' => 'Testfax', 'country' => '2', 'stateID' => '3', 'ustid' => 'Testustid', 'birthyear' => '1999', 'birthmonth' => '2', 'birthday' => '21', 'text1' => 'text1', 'text2' => 'text2', 'text3' => 'text3', 'text4' => 'text4', 'text5' => 'text5', 'text6' => 'text6'); $result = $this->module->sSaveRegisterBilling($userId, array('billing' => $testData)); $this->assertGreaterThan(0, $result); $savedData = Shopware()->Db()->fetchRow(' SELECT * FROM s_user_billingaddress LEFT JOIN s_user_billingaddress_attributes ON s_user_billingaddress.id = s_user_billingaddress_attributes.billingID WHERE s_user_billingaddress.id = ? ', array($result)); // Prepare demo data for comparison $testData['countryID'] = $testData['country']; unset($testData['country']); $testData['birthday'] = mktime(0, 0, 0, (int) $testData['birthmonth'], (int) $testData['birthday'], (int) $testData['birthyear']); $testData['birthday'] = '1999-02-21'; unset($testData['birthmonth']); unset($testData['birthyear']); foreach ($testData as $name => $value) { $this->assertEquals($savedData[$name], $value); } Shopware()->Db()->delete('s_user_billingaddress_attributes', 'billingID = ' . $result); Shopware()->Db()->delete('s_user_billingaddress', 'userID = ' . $userId); }