Commit Graph

7 Commits

Author SHA1 Message Date
michael-grunder
c6cd665bde Code formatting 2024-05-30 12:10:46 -07:00
Michael Grunder
b88e72b1e6 Refactor session tests (#2492)
* Refactor session tests

* Update these external scripts to take formal arguments with `getopt` to
  make it more straightforward what each of the currently positional
  arguments are actually for.

* Create small helper classes for invoking these external scripts.
  Instead of `startSessionProcess` that takes a dozen argument all but
  three of which have defaults, we can use a construct like this:

  ```php
  $runner = $this->sessionRunner()
      ->maxExecutionTime(300)
      ->lockingEnabled(true)
      ->lockWaitTime(-1)
      ->lockExpires(0)
      ->data($data)
      ->compression($name);

  // Invokes startSession.php with above args.
  $result = $runner->execFg();

  // Invokes regenerateSessionId.php with above args
  $new_id = $runner->regenerateId();

  // Invokes getSessionData.php for this session ID.
  $data = $runner->getData();
  ```

* Add a bit of logic to TestSuite to dump more information about the
  source of an assertion to make it easier to track down problems when
  we assert outside of a top level public `test_*` method.

* Create a few new assertions like `assertKeyExists` and
  `assertKeyMissing` which will generate much nicer assertions as
  opposed to

```php
$this->assertTrue($this->redis->exists($some_key));
```

* If our externally spawned session scripts fail output the exact call
  that was made along with all arguments as well as the output that we
  received to make it easier to narrow down.

* snake_case -> camelCase
2024-05-23 09:43:36 -07:00
Marius Meissner
d0cada2268 PHPREDIS-1354: Refactored tests to work also with Redis cluster 2018-06-06 09:55:50 +02:00
Marius Meissner
21436f61dd PHPREDIS-1354: Added session lifetime parameter for reading session data 2018-05-23 12:13:13 +02:00
Marius Meissner
810df7bcf2 PHPREDIS-37: Adjusted error reporting to show warnings but no notices 2017-11-02 15:28:28 +01:00
Marius Meissner
97e034efb0 PHPREDIS-37: Disabled error_reporting for session tests, to avoid failing tests caused by correct thrown warnings/notices 2017-11-02 14:24:51 +01:00
Marius Meissner
abb862d2f5 PHPREDIS-37: Add locking functionality 2017-10-30 11:28:33 +01:00