ImboUnitTest\EventListener\ImageVariationsTest::testTriggersWarningIfVariationFoundInDbButNotStorage PHP Method

testTriggersWarningIfVariationFoundInDbButNotStorage() public method

    public function testTriggersWarningIfVariationFoundInDbButNotStorage()
    {
        $width = 1024;
        $height = 768;
        $transformationWidth = 512;
        $variationWidth = 800;
        $transformations = [['name' => 'desaturate', 'params' => []], ['name' => 'maxSize', 'params' => ['width' => $transformationWidth]]];
        $this->imageModel->expects($this->atLeastOnce())->method('getWidth')->will($this->returnValue($width));
        $this->imageModel->expects($this->atLeastOnce())->method('getHeight')->will($this->returnValue($height));
        $this->request->expects($this->atLeastOnce())->method('getTransformations')->will($this->returnValue($transformations));
        $this->db->expects($this->atLeastOnce())->method('getBestMatch')->with($this->user, $this->imageIdentifier, $transformationWidth)->will($this->returnValue(['width' => $variationWidth, 'height' => 600]));
        $this->eventManager->expects($this->atLeastOnce())->method('trigger')->with('image.transformations.adjust', ['transformationIndex' => 1, 'ratio' => $width / $variationWidth]);
        $this->storage->expects($this->atLeastOnce())->method('getImageVariation')->with($this->user, $this->imageIdentifier, $variationWidth)->will($this->returnValue(false));
        $this->imageStorage->expects($this->never())->method('getLastModified');
        // Running this twice, once with error suppresion (to flag "return" for code coverage),
        // once for triggering the warning
        @$this->listener->chooseVariation($this->event);
        $this->listener->chooseVariation($this->event);
    }