/** * create dependent objects before running each test **/ public final function setUp() { // run the default setUp() method first parent::setUp(); // create and insert a Company to test Schedule $this->company = new Company(null, "Kitty Scratchers", "1600 Pennsylvania Ave NW", "Senator's Palace", "Senator Arlo", "WA", "Felis Felix", "20500", "+12125551212", "*****@*****.**", "www.kitty.com"); $this->company->insert($this->getPDO()); $_SESSION["company"] = $this->company; // create and insert a Crew to own the test Schedule $this->crew = new Crew(null, $this->company->getCompanyId(), "Taco Bell"); $this->crew->insert($this->getPDO()); // calculate the date (just use the time the unit test was setup...) $this->VALID_SCHEDULESTARTDATE = new \DateTime(); }
/** * create dependent objects before running each test */ public final function setUp() { //run the default setUp() method first parent::setUp(); //this is for the hash & salt $password = "******"; $this->VALID_USERACTIVATION = bin2hex(random_bytes(16)); $this->VALID_USERSALT = bin2hex(random_bytes(32)); $this->VALID_USERHASH = hash_pbkdf2("sha512", $password, $this->VALID_USERSALT, 262144); //create and insert a new company to own the crew the user belongs to $this->company = new Company(null, "Taco B.", "404 Taco St.", "suite:666", "Attention!!", "NM", "Burque", "87106", "5055551111", "*****@*****.**", "www.tocobell.com"); $this->company->insert($this->getPDO()); $_SESSION["company"] = $this->company; // create and insert a crew to own the test Schedule $this->crew = new Crew(null, $this->company->getCompanyId(), "Taco Bell"); $this->crew->insert($this->getPDO()); // create and insert Access that is attached to the user $this->access = new Access(null, "requestor or admin"); $this->access->insert($this->getPDO()); }
/** *create dependent objects before running each test **/ public final function setUp() { //run the default setUp() method first parent::setUp(); // *********************** $password = "******"; $activation = bin2hex(random_bytes(16)); $salt = bin2hex(random_bytes(32)); $hash = hash_pbkdf2("sha512", $password, $salt, 262144); // creates and inserts Company to sql for User foreign key relations $this->company = new Company(null, "Taco B.", "404 Taco St.", "suite:666", "Attention!!", "NM", "Burque", "87106", "5055551111", "*****@*****.**", "www.tocobell.com"); $this->company->insert($this->getPDO()); $_SESSION["company"] = $this->company; // creates and inserts Access to sql for User foreign key relations $this->access = new Access(null, "requestor or admin"); $this->access->insert($this->getPDO()); // create and insert a Crew to own the test Schedule $this->crew = new Crew(null, $this->company->getCompanyId(), "Burque"); $this->crew->insert($this->getPDO()); //***************** //create and insert a User to test Shift $this->requestor = new User(null, $this->company->getCompanyId(), $this->crew->getCrewId(), $this->access->getAccessId(), "5551212", "Johnny", "Requestorman", "*****@*****.**", $activation, $hash, $salt); $this->requestor->insert($this->getPDO()); //create and insert a User to test Shift $this->admin = new User(null, $this->company->getCompanyId(), $this->crew->getCrewId(), $this->access->getAccessId(), "5551212", "Dave", "Adminman", "*****@*****.**", $activation, $hash, $salt); $this->admin->insert($this->getPDO()); //create and insert a Request to test Shift $this->request = new Request(null, $this->requestor->getUserId(), $this->admin->getUserId(), null, null, false, "I can haz time off nao, plz?", "Yes, and bring me a sandwich."); $this->request->insert($this->getPDO()); }