1: <?php
2: namespace Azalea\Selenium\App\Patients;
3:
4: use Azalea\Selenium\Toolkit\View;
5:
6: class Patient extends View
7: {
8: /**
9: * Waits for the default patient hash to appear in the location
10: * for $timeout seconds. Returns the pat_id from the hash.
11: *
12: * @param int $timeout
13: * @return int
14: */
15: public static function waitForHash($driver, $timeout = 30)
16: {
17: // extract the new patient id from the hash
18: $matches = null;
19: $regex = "/#\/patients\/p\/(\d+)\/\w+/";
20: $driver->waitForHash($regex);
21: preg_match($regex, $driver->getCurrentHash(), $matches);
22: $pat_id = $matches[1];
23: return $pat_id;
24: }
25: }
26:
27: ?>
28: