Skip to content

Commit

Permalink
Merge pull request #21 from MacPaw/develop
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
Yozhef authored Jun 17, 2024
2 parents d011edb + 8c38f96 commit f58b7ab
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 5 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,9 @@ jobs:
- name: PHPUnit tests and Log Code coverage
run: vendor/bin/phpunit --coverage-clover=coverage.xml
if: matrix.coverage == 'xdebug'

- name: Run codecov
uses: codecov/codecov-action@v1

- name: Upload coverage reports to Codecov
if: matrix.coverage == 'xdebug'
uses: codecov/[email protected]
with:
file: './coverage.xml'
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
46 changes: 46 additions & 0 deletions src/Context/RedisContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ public function iSaveStringParamsToRedis(string $value, string $key): void
$this->redis->set($key, $value);
}

/**
* @When /^I save serialized value "([^"]*)" to redis by "([^"]*)"$/
*/
public function iSaveSerializedParamsToRedis(string $value, string $key): void
{
$this->redis->set($key, serialize($value));
}

/**
* @param string $value
* @param string $key
Expand Down Expand Up @@ -106,4 +114,42 @@ public function iSeeInRedisArrayByKey(string $key, PyStringNode $string): void
throw new RuntimeException($message);
}
}

/**
* @throws InvalidArgumentException
*
* @When /^I see in redis any value by key "([^"]*)"$/
*/
public function iSeeInRedisAnyValueByKey(string $key): void
{
$found = $this->redis->get($key);

if (null === $found) {
throw new InvalidArgumentException(sprintf('In Redis does not exist data for key "%s"', $key));
}
}

/**
* @When /^I see in redis serialized value "([^"]*)" by key "([^"]*)"$/
*/
public function iSeeInRedisSerializedValueByKey(string $value, string $key): void
{
$found = $this->redis->get($key);

if (null === $found) {
throw new InvalidArgumentException(sprintf('In Redis does not exist data for key "%s"', $key));
}

/** @var string $found */
$found = unserialize($found);

if ($value !== $found) {
throw new InvalidArgumentException(sprintf(
'Value in key "%s" do not match "%s" actual "%s"',
$key,
$value,
$found,
));
}
}
}

0 comments on commit f58b7ab

Please sign in to comment.