예제 #1
0
 /**
  * This setUp function creates user salt and user hash values for unit testing
  * @var string $VALID_USERSALT
  * @var string $VALID_USERHASH
  */
 public function setUp()
 {
     parent::setUp();
     $this->VALID_USERSALT = bin2hex(openssl_random_pseudo_bytes(32));
     $this->VALID_USERHASH = hash_pbkdf2("sha512", "iLoveIllinois", $this->VALID_USERSALT, 262144, 128);
     $this->VALID_CREATEDATE = DateTime::createFromFormat("Y-m-d H:i:s", $this->VALID_CREATEDATE);
 }
예제 #2
0
 /**
  * create dependent objects before running each test
  **/
 public function setUp()
 {
     //run the default setUp() method first
     parent::setUp();
     //create and insert a point for segmentStart
     $this->VALID_SEGMENTSTART = new Point(35.554, 44.546);
     //create and insert a point for segmentStop
     $this->VALID_SEGMENTSTOP = new Point(34.556, 44.435);
 }
 /**
  * create dependent objects before running each test
  **/
 public function setUp()
 {
     //run the default setUp() method first
     parent::setUp();
     $this->VALID_DATE = DateTime::createFromFormat("Y-m-d H:i:s", $this->VALID_DATE);
     //create browser
     $this->VALID_BROWSER = "Chrome";
     $this->VALID_USERSALT = bin2hex(openssl_random_pseudo_bytes(32));
     $this->VALID_USERHASH = $this->VALID_USERHASH = hash_pbkdf2("sha512", "password4321", $this->VALID_USERSALT, 262144, 128);
     //create and insert a userId to own the trail
     $this->user = new User(null, $this->VALID_BROWSER, $this->VALID_DATE, "192.168.1.168", "S", "*****@*****.**", $this->VALID_USERHASH, "Hyourname.tomorrow", $this->VALID_USERSALT);
     $this->user->insert($this->getPDO());
     $this->VALID_TRAILNAME = "La Luz";
     //create and insert a trailId to own the test Trail Relationship
     //$newTrailId, $newUserId, $newBrowser, $newCreateDate, $newIpAddress, $newSubmitTrailId, $newTrailAccessibility, $newTrailAmenities, $newTrailCondition, $newTrailDescription, $newTrailDifficulty, $newTrailDistance, $newTrailName, $newTrailSubmissionType, $newTrailTerrain, $newTrailTraffic, $newTrailUse, $newTrailUuid
     $this->trail = new Trail(null, $this->user->getUserId(), "Safari", $this->VALID_DATE, "192.168.1.4", null, "y", "Picnic area", "Good", "This trail is a beautiful winding trail located in the Sandia Mountains", 3, 1054.53, $this->VALID_TRAILNAME, 1, "Mostly switchbacks with a few sections of rock fall", "Heavy", "Hiking", "SSEERFFV4444554");
     $this->trail->insert($this->getPDO());
     $this->segmentStart = new Point(35.554, 44.546);
     $this->segmentStop = new Point(6, 36);
     //create and insert a segmentId to own the test Trail Relationship
     $this->segment = new Segment(null, $this->segmentStart, $this->segmentStop, 1000, 2000);
     $this->segment->insert($this->getPDO());
 }
예제 #4
0
 /**
  * This setUp function changes the date string to a DateTime object, creates a segment, creates test values for user salt and hash, and then creates user and trail entries to use for testing
  */
 public function setUp()
 {
     parent::setUp();
     // necessary DateTime format to run the test
     $this->VALID_CREATEDATE = DateTime::createFromFormat("Y-m-d H:i:s", $this->VALID_CREATEDATE);
     //create points needed for segment
     $segmentStart = new Point(35.554, 44.546);
     $segmentStop = new Point(35.554, 48.445);
     //create new segment to use for testing
     $this->segment = new Segment(null, $segmentStart, $segmentStop, 7565, 9800);
     $this->segment->insert($this->getPDO());
     //create needed dependencies to ensure user can be created to run unit testing
     $this->salt = bin2hex(openssl_random_pseudo_bytes(32));
     $this->hash = hash_pbkdf2("sha512", "iLoveIllinois", $this->salt, 262144, 128);
     //create a new user to use for testing
     $this->user = new User(null, $this->VALID_BROWSER, $this->VALID_CREATEDATE, $this->VALID_IPADDRESS, "S", "*****@*****.**", $this->hash, "george kephart", $this->salt);
     $this->user->insert($this->getPDO());
     // create a trail to own test
     // Trail(trailId, userId, browser, createDate, ipAddress, submitTrailId, trailAccessibility, trailAmenities, trailConditions,
     $this->trail = new Trail(null, $this->user->getUserId(), "Safari", $this->VALID_CREATEDATE, $this->VALID_IPADDRESS, null, "y", "Picnic area", "Good", "This trail is a beautiful winding trail located in the Sandia Mountains", 3, 1054.53, "la luz trail", 1, "Mostly switchbacks with a few sections of rock fall", "Heavy", "Hiking", "fpfyRTmt6XeE9ehEKZ5LwF");
     $this->trail->insert($this->getPDO());
 }
예제 #5
0
 /**
  * create dependent objects before running each test
  *
  */
 public function setUp()
 {
     //run the default setUp() method first
     parent::setUp();
     $this->VALID_TRAILUUID = ShortUuid::uuid4();
     //		var_dump($this->VALID_TRAILUUID);
     //create and insert a datetime object
     $this->VALID_CREATEDATE = DateTime::createFromFormat("Y-m-d H:i:s", $this->VALID_CREATEDATE);
     //create browser
     $this->VALID_BROWSER = "Safari";
     $this->VALID_USERSALT = bin2hex(openssl_random_pseudo_bytes(32));
     $this->VALID_USERHASH = $this->VALID_USERHASH = hash_pbkdf2("sha512", "password4321", $this->VALID_USERSALT, 262144, 128);
     //create and insert a userId to own the trail
     $this->user = new User(null, $this->VALID_BROWSER, $this->VALID_CREATEDATE, "192.168.1.168", "S", "*****@*****.**", $this->VALID_USERHASH, "Hyourname.tomorrow", $this->VALID_USERSALT);
     $this->user->insert($this->getPDO());
 }