function testSetBusinessName() { //Arrange $business_name = "apple"; $test_business = new Business($business_name); //Act $test_business->setBusinessName("apple"); $result = $test_business->getBusinessName(); //Assert $this->assertEquals("apple", $result); }
public static function map(Business $business, array $properties) { if (array_key_exists('id', $properties)) { $business->setId($properties['id']); } if (array_key_exists('business_name', $properties)) { $business->setBusinessName($properties['business_name']); } if (array_key_exists('address_id', $properties)) { $business->setAddressId($properties['address_id']); } }
function testSetBusinessName() { //Arrange $business_name = "IBM"; $business_phone = "5033133131"; $business_contact = "john"; $business_website = "walkins.com"; $business_address = "123 fake st"; $business_contact_email = "*****@*****.**"; $id = 5; $test_business = new Business($business_name, $business_phone, $business_contact, $business_website, $business_address, $business_contact_email, $id = null); //Act $test_business->setBusinessName("IBM"); $result = $test_business->getBusinessName(); //Assert $this->assertEquals("IBM", $result); }
$BusinessNameEnd finds the end of the name by looking for the 2 character in the business code. This logic works because the business code always starts with a 2. */ $BusinessNameEnd = strpos(substr($s, 19), '2'); //set the starting position for the business information so no math is done in the function call. $startPos = 0; //line number $business->setLineCount($lineCount); // serial number: first 16 characters of the line $business->validLineLength($business->setSerialNumber(substr($s, $startPos, 16)), 16); // language: next 3 characters of the line $startPos = $startPos + 16; $business->validLineLength($business->setLanguage(substr($s, $startPos, 3)), 3); // business name: next 32 characters of the line $startPos = $startPos + 3; $business->validLineLength($business->setBusinessName(substr($s, $startPos, $BusinessNameEnd)), 32); // business code: next 8 characters of the line $startPos = $startPos + $BusinessNameEnd; $business->validLineLength($business->setBusinessCode(substr($s, $startPos, 8)), 8); // autorization code: next 8 characters of the line $startPos = $startPos + 8; $business->validLineLength($business->setAuthorizationCode(substr($s, $startPos, 8)), 8); // timestamp: next 20 characters of the line $startPos = $startPos + 8; $business->validLineLength($business->setTimeStamp(substr($s, $startPos, 20)), 20); //display the business information to the screen $business->printBusinessInfo(); //increment the line counter $lineCount++; } //close the file