21 Commits

Author SHA1 Message Date
michael-grunder
b808cc60ed Update tests so they can run in php-cgi.
This probably isn't a very common scenerio since we've never had someone
ask it in a decade, but it was very simple to get them working.

Primarily we just needed to test for `STDTOUT`/`STDERR` and use
`__DIR__` instead of `$_SERVER['PHP_SELF']`.

Fixes #2507
2024-06-17 11:46:44 -07:00
michael-grunder
c6cd665bde Code formatting 2024-05-30 12:10:46 -07:00
michael-grunder
78b70ca8f4 More test refactoring.
* Switch remaining old-style PHP 5.4 `Array(...)` declarations to `[...]`
* Update variable names getting rid hungarian notation prefixes (e.g.
  `str_`, `i_`, etc).
* Allow cluster seeds to be passed on the command-line instead of soley
  relying on either a node environment variable or our
  tests/nodes/nodemap file.  This should make it easier to run ad-hoc
  cluster tests by specifying just a single seed.
* Add some diagnostics for when we can't find a suitable cluster to run
  our tests against indicating exactly where we looked for the env var
  and node file.
* Refactor RedisArray tests to use our newer TestSuite assertions.
* Allow `RedisArray` ports to be specified on the command-line as well.
* Various formatting fixes.
* More robust KeyDB detection.
2024-05-29 23:02:29 -07:00
michael-grunder
3c125b09f4 More unit test cleanup.
* Tighten up `assertTrue` and `assertFalse` such that they test that
  passed arguments `===` `true` and `===` `false` respectively, instead
  of testing for truth-like or false-like.

* Start modernizing our unit tests to use explicit types for arguments,
  return types, member variables, etc.

* Multiple assertion fixes that were exposed when making `assertTrue`
  and `assertFalse` more explicit.

* Some formatting cleanup to style for incorrect indentation, etc, that
  had crept in over many years.

* Add some more assertion helpers like `assertNull`, `assertGT`,
  `assertGTE`, `assertLT`, and `assertLTE`.
2024-05-28 20:13:12 -07:00
Viktor Szépe
37c5f8d451 Fix typos 2024-02-21 13:16:12 -08:00
michael-grunder
5f6ce414c3 Update tests to allow users to use a custom class.
Add a mechanism that allows users to specify an arbitrary class name, in
combination with a search path so that PhpRedis unit tests can be run
against a different client.

Additionally, this commit allows multiple classes to be invoked in one
test execution either by passing multiple `--class` arguments, or a
class argument with a comma separated value.
2023-09-19 11:57:49 -07:00
michael-grunder
0264de1824 A small test for key scanning in RedisArray
See: #2055
2022-01-30 10:21:13 -08:00
Michael Grunder
a311cc4ec3 Support for Redis 6 ACLs (#1791)
Add support for Redis 6 ACLs in the `Redis`, `RedisCluster`, and `RedisArray` classes.

On a related note, it adds a mechanism for users to customize how we generate persistent connection IDs such that they can be grouped in different ways depending on the specific use case required (e.g. it would allow connections to be grouped by username, or by user-defined persistent_id, or both).
2020-06-24 17:00:01 -07:00
Michael Grunder
201a975999 Make unit test authentication configurable (#1748)
Right now cloning the repo and running unit tests will all fail if the
Redis/RedisCluster instances aren't configured with the password
'phpredis'.

This commit simply makes authentication during the tests optional via a
command-line argument.
2020-04-30 21:22:40 -07:00
Pavlo Yatsukhnenko
e37f38a39e requirepass 2020-03-30 13:32:27 +03:00
michael-grunder
9440f05e19 Switch everything to new array syntax 2019-02-09 14:12:52 -08:00
michael-grunder
6028df5226 Remove debug line in unit tests 2018-01-17 14:40:32 -08:00
michael-grunder
9e65c42931 Implement UNLINK command
This commit implements UNLINK for Redis, RedisCluster, and RedisArray.
To a client library UNLINK behaves identically to DEL so we can use the
same handlers for both.
2018-01-17 09:36:38 -08:00
michael-grunder
cccc3997e9 Update EXISTS to handle multiple keys
Fixes #1223
2017-08-20 13:28:00 -07:00
michael-grunder
4aff3f9c00 Make RedisArray tests exit with a nonzero exit code on failure 2017-03-25 14:28:29 -07:00
michael-grunder
3012052849 More IPv6 additions
* Modified RedisArray to support IPv6
* Updated general test suite to take an override host
* Updated make-cluster.sh to take an override host
2016-02-12 18:10:50 -08:00
michael-grunder
7175aee5e2 Don't double define constant (rebase/merge fail) 2015-05-08 15:31:40 -07:00
michael-grunder
fb0597992a Merge remote 2015-05-07 16:30:11 -07:00
michael-grunder
08ecec92a3 Unit test suite improvements and cluster failover test
* Added a test specifically for RedisCluster to test slave failover
  settings.
* Added an option to specifically disable colorization, as well as
  a mechanism to determine if the output is being piped, such that
  we can turn colorization off in that case as well.
2015-05-05 15:18:02 -07:00
michael-grunder
97c9edc3aa Sorted a memory leak in RedisArray and retabbed unit tests 2015-05-05 15:18:01 -07:00
michael-grunder
79cb6a8905 Initial commit reworking unit tests
This commit reworks the unit tests such that all three classes
(Redis, RedisArray, and RedisCluster) can be tested using the
TestRedis.php script.

Now, when running TestRedis.php an option can be passed for which
part of phpredis we would like to test (defaults to Redis).
2015-05-05 15:07:43 -07:00