Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serializer plugin does not store the initial values when incrementing/decrementing values #116

Closed
boesing opened this issue May 24, 2021 · 1 comment · Fixed by #135
Closed
Labels
Bug Something isn't working
Milestone

Comments

@boesing
Copy link
Member

boesing commented May 24, 2021

Bug Report

Q A
Version(s) 2.11.1

Summary

Given the AbstractCommonAdapterTest::testIncrementItemInitialValue and AbstractCommonAdapterTest::testDecrementItemInitialValue, the adapter has to treat non-existent values as 0 when using increment or decrement methods.

Current behavior

When using the Serializer plugin, increment and decrement will immediately stop due to the plugin stopping the propagation of the event.

How to reproduce

There are existing unit tests which are already failing within the AbstractCommonAdapterTest.

public function testDecrementItemInitialValue(): void
{
    $this->assertEquals(-5, $this->storage->decrementItem('counter', 5));
    $this->assertEquals(-5, $this->storage->getItem('counter'));
}
public function testIncrementItemInitialValue(): void
{
    $this->assertEquals(5, $this->storage->incrementItem('counter', 5));
    $this->assertEquals(5, $this->storage->getItem('counter'));
}

Both tests have to be executed with adapters implementing the Serializer plugin.

Expected behavior

Tests are passing.

@boesing boesing added the Bug Something isn't working label May 24, 2021
boesing added a commit to boesing/laminas-cache that referenced this issue Jul 27, 2021
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
boesing added a commit to boesing/laminas-cache that referenced this issue Jul 27, 2021
…-existent values as 0

Fixes laminas#116

Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
@boesing boesing added this to the 2.12.0 milestone Jul 27, 2021
@boesing
Copy link
Member Author

boesing commented Jul 27, 2021

Closed with #135

@boesing boesing closed this as completed Jul 27, 2021
boesing added a commit that referenced this issue Jul 30, 2021
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
boesing added a commit that referenced this issue Jul 30, 2021
…-existent values as 0

Fixes #116

Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
1 participant