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

Database cleanup after every test #29

Open
dingo-d opened this issue Sep 20, 2023 · 0 comments
Open

Database cleanup after every test #29

dingo-d opened this issue Sep 20, 2023 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@dingo-d
Copy link
Owner

dingo-d commented Sep 20, 2023

Describe your bug

In the #18 it was noted that the DB isn't being cleaned up after each tests.

The default WP integration test case should cover this already, but I'll need to investigate.

Steps to Reproduce

  1. Create the following test:
test("Adding a record to the db", function () {
    global $wpdb;
    $row = $wpdb->get_row("
        SELECT *
        FROM {$wpdb->postmeta}
        WHERE meta_id=6969
    ", ARRAY_A);
    expect($row)->not()->toBeEmpty();
})->with([
    function () {
        global $wpdb;
        $wpdb->insert($wpdb->postmeta, [
            'meta_id' => 6969,
            'post_id' => 9696,
            'meta_key' => 'testing',
            'meta_value' => 'Just a test.'
        ]);
    }
]);
  1. Run it twice
  2. See the results

Expected behavior

Test should pass every time the test suite is run.

Screenshots, screen recording, code snippet

No response

Environment info

No response

Please confirm that you have searched existing issues in this repo.

Yes

@dingo-d dingo-d added the bug Something isn't working label Sep 20, 2023
@dingo-d dingo-d self-assigned this Sep 20, 2023
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
Development

No branches or pull requests

1 participant