2 Commits

Author SHA1 Message Date
Remi Collet
3828c9293b cleanup session temp file (#2641)
* cleanup session temp file

* Fix Deprecated: Automatic conversion of false to array
2025-03-26 15:25:22 -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