1 | <?php |
||
29 | abstract class VanillaSessionAtoum extends Atoum |
||
30 | { |
||
31 | private $session_builder; |
||
32 | |||
33 | /** |
||
34 | * buildSession |
||
35 | * |
||
36 | * A short description here |
||
37 | * |
||
38 | * @param string $stamp |
||
39 | * @return Session |
||
40 | */ |
||
41 | protected function buildSession($stamp = null) |
||
42 | { |
||
43 | $session = $this->getSessionBuilder()->buildSession($stamp); |
||
44 | $this->initializeSession($session); |
||
45 | |||
46 | return $session; |
||
47 | } |
||
48 | |||
49 | /** |
||
50 | * getSessionBuilder |
||
51 | * |
||
52 | * Return a SessionBuilder. |
||
53 | * |
||
54 | * @return SessionBuilder |
||
55 | */ |
||
56 | private function getSessionBuilder() |
||
57 | { |
||
58 | if ($this->session_builder === null) { |
||
59 | $this->session_builder = $this->createSessionBuilder($GLOBALS['pomm_db1']); |
||
60 | } |
||
61 | |||
62 | return $this->session_builder; |
||
63 | } |
||
64 | |||
65 | /** |
||
66 | * createSessionBuilder |
||
67 | * |
||
68 | * Instantiate a new SessionBuilder. This method is to be overloaded by |
||
69 | * each package to instantiate their own SessionBuilder if any. |
||
70 | * |
||
71 | * @param array $configuration |
||
72 | * @return SessionBuilder |
||
73 | */ |
||
74 | protected function createSessionBuilder(array $configuration) |
||
75 | { |
||
76 | return new SessionBuilder($configuration); |
||
77 | } |
||
78 | |||
79 | /** |
||
80 | * initializeSession |
||
81 | * |
||
82 | * If the test needs special poolers and/or client configuration, it goes |
||
83 | * here. |
||
84 | * |
||
85 | * @param Session $session |
||
86 | * @return null |
||
87 | */ |
||
88 | abstract protected function initializeSession(Session $session); |
||
89 | } |
||
90 |