SoftDelete\Test\TestCase\Model\Table\SoftDeleteBehaviorTest::testCounterCache PHP Method

testCounterCache() public method

Tests that soft deleting affects counters the same way that hard deleting.
public testCounterCache ( )
    public function testCounterCache()
    {
        $post = $this->postsTable->get(1);
        $this->postsTable->delete($post);
        $this->assertNotEquals(null, $this->postsTable->find('all', ['withDeleted'])->where(['id' => 1])->first());
        $this->assertEquals(null, $this->postsTable->findById(1)->first());
        $user = $this->usersTable->get(1);
        $this->assertEquals(1, $user->posts_count);
    }