public function testLocationIsValid() { $zipcodes = array(48438, 48471, 48460, 45071, 56043); $validator = new Validator(); $result = $validator->locationIsValid($zipcodes, 90210); $this->assertFalse($result); $validator = new Validator(); $result = $validator->locationIsValid($zipcodes, 54332); $this->assertTrue($result); }
/** * Check whether the incoming zipcode is within a valid distance * from a previous set of zipcodes * * @param array $previous_zipcodes * @param int $incoming_zipcode * @return bool */ public function locationIsValid($previous_zipcodes, $incoming_zipcode) { $validator = new Validator(); return $validator->locationIsValid($previous_zipcodes, $incoming_zipcode); }