Skip to content

Commit

Permalink
minor #52111 [HttpKernel] Fix CacheWarmerAggregateTest (alexandre-dau…
Browse files Browse the repository at this point in the history
…bois)

This PR was merged into the 6.4 branch.

Discussion
----------

[HttpKernel] Fix CacheWarmerAggregateTest

| Q             | A
| ------------- | ---
| Branch?       | 6.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT

#50391 seems to bring broken tests. Particularly, the `testWarmupOnOptionalWarmerPassBuildDir` test doesn't seem relevant given the actual code of `CacheWarmerAggregate`. Indeed, nothing in the code is setting `buildDir` to null when using an optional warmer. I suggest a changes to fix this test on 6.4.

Also for the first one, given `optionalsEnabled` is enabled, `isOptional` is never called. I suggest to remove this expectation.

Commits
-------

945d5cd [HttpKernel] Fix CacheWarmerAggregateTest
  • Loading branch information
nicolas-grekas committed Oct 17, 2023
2 parents c817241 + 945d5cd commit d4b65e4
Showing 1 changed file with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,6 @@ public function testWarmupChecksInvalidFiles()
public function testWarmupPassBuildDir()
{
$warmer = $this->createMock(CacheWarmerInterface::class);
$warmer
->expects($this->once())
->method('isOptional')
->willReturn(false);
$warmer
->expects($this->once())
->method('warmUp')
Expand All @@ -110,7 +106,7 @@ public function testWarmupPassBuildDir()
$aggregate->warmUp('cache_dir', 'build_dir');
}

public function testWarmupOnOptionalWarmerDoNotPassBuildDir()
public function testWarmupOnOptionalWarmerPassBuildDir()
{
$warmer = $this->createMock(CacheWarmerInterface::class);
$warmer
Expand All @@ -120,10 +116,10 @@ public function testWarmupOnOptionalWarmerDoNotPassBuildDir()
$warmer
->expects($this->once())
->method('warmUp')
->with('cache_dir', null);
->with('cache_dir', 'build_dir');

$aggregate = new CacheWarmerAggregate([$warmer]);
$aggregate->enableOptionalWarmers();
$aggregate->enableOnlyOptionalWarmers();
$aggregate->warmUp('cache_dir', 'build_dir');
}

Expand Down

0 comments on commit d4b65e4

Please sign in to comment.