Skip to content

Commit

Permalink
Fix to broken tests for Responsive Media Conversions. (#3743)
Browse files Browse the repository at this point in the history
* Update ResponsiveImageTest.php

remove incorrect test

* Update ConversionTest.php

add correct tests
  • Loading branch information
aSeriousDeveloper authored Dec 11, 2024
1 parent 7cc39b6 commit ca56824
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
12 changes: 12 additions & 0 deletions tests/Conversions/ConversionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@
expect($this->conversion->getManipulations()->getManipulationArgument('format'))->toEqual(['png']);
});

it('will set conversions to responsive', function () {
$this->conversion->withResponsiveImages();

expect($this->conversion->shouldGenerateResponsiveImages())->toBeTrue();
});

it('will set conversions to not be responsive', function () {
$this->conversion->withResponsiveImages()->withResponsiveImages(false);

expect($this->conversion->shouldGenerateResponsiveImages())->toBeFalse();
});

it('will be performed on the given collection names', function () {
$this->conversion->performOnCollections('images', 'downloads');
expect($this->conversion->shouldBePerformedOn('images'))->toBeTrue();
Expand Down
15 changes: 0 additions & 15 deletions tests/ResponsiveImages/ResponsiveImageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,18 +112,3 @@

expect($media->getResponsiveImageUrls('non-existing-conversion'))->toBe([]);
});

test('a media instance can be set to not generate responsive urls', function () {
$this
->testModelWithResponsiveImages
->addMedia($this->getTestJpg())
->withResponsiveImages()
->withResponsiveImages(false)
->toMediaCollection();

$media = $this->testModelWithResponsiveImages->getFirstMedia();

expect($media->hasResponsiveImages())->toBeFalse();

expect($media->hasResponsiveImages('thumb'))->toBeFalse();
});

0 comments on commit ca56824

Please sign in to comment.