Skip to content

Cleanup version

Choose a tag to compare

@mattiasgeniar mattiasgeniar released this 18 Jan 21:40
· 49 commits to master since this release

Simplify API by consolidating tracking methods

Summary

  • Consolidated trackQueriesForEfficiency() into trackQueries() — one method now does everything
  • Changed trackQueries() from static to instance method for consistent $this-> API

Breaking Changes

self::trackQueries() → $this->trackQueries()

The method is no longer static. Update your setUp/beforeEach:

// Before
protected function setUp(): void
{
    parent::setUp();
    self::trackQueries();
}

// After
protected function setUp(): void
{
    parent::setUp();
    $this->trackQueries();
}

trackQueriesForEfficiency() is deprecated

Replace with trackQueries():

// Before
$this->trackQueriesForEfficiency();

// After
$this->trackQueries();

Migration

Find and replace in your test files:

Find Replace
self::trackQueries() $this->trackQueries()
$this->trackQueriesForEfficiency() $this->trackQueries()

Why

The previous API had two methods that were confusingly similar:

  • trackQueries() — basic query logging
  • trackQueriesForEfficiency() — query logging + N+1 detection

Now there's just one method that does everything. If you only need query counts, the efficiency tracking has zero overhead — just don't call assertQueriesAreEfficient().