| Conditions | 1 |
| Paths | 1 |
| Total Lines | 15 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 24 | public function setUp() |
||
|
|
|||
| 25 | { |
||
| 26 | $storage = new Storage( |
||
| 27 | new PDO( |
||
| 28 | $GLOBALS['DB_DSN'], |
||
| 29 | $GLOBALS['DB_USER'], |
||
| 30 | $GLOBALS['DB_PASSWD'] |
||
| 31 | ), |
||
| 32 | new DateTime() |
||
| 33 | ); |
||
| 34 | $storage->init(); |
||
| 35 | $storage->setTotpSecret('foo', 'CN2XAL23SIFTDFXZ'); |
||
| 36 | |||
| 37 | $this->totp = new Totp($storage); |
||
| 38 | } |
||
| 39 | |||
| 56 |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: