Neos\Media\Tests\Unit\Domain\Model\Adjustment\CropImageAdjustmentTest::refitFitsCropPropertionWithinImageSizeConstraints PHP Метод

refitFitsCropPropertionWithinImageSizeConstraints() публичный Метод

public refitFitsCropPropertionWithinImageSizeConstraints ( $cropX, $cropY, $cropWidth, $cropHeight, $newImageWidth, $newImageHeight, $expectedX, $expectedY, $expectedWidth, $expectedHeight )
    public function refitFitsCropPropertionWithinImageSizeConstraints($cropX, $cropY, $cropWidth, $cropHeight, $newImageWidth, $newImageHeight, $expectedX, $expectedY, $expectedWidth, $expectedHeight)
    {
        $mockImage = $this->getMockBuilder(\Neos\Media\Domain\Model\Image::class)->disableOriginalConstructor()->getMock();
        $mockImage->expects($this->any())->method('getWidth')->will($this->returnValue($newImageWidth));
        $mockImage->expects($this->any())->method('getHeight')->will($this->returnValue($newImageHeight));
        $mockCropImageAdjustment = $this->getAccessibleMock(\Neos\Media\Domain\Model\Adjustment\CropImageAdjustment::class, ['dummy'], [], '', false);
        $mockCropImageAdjustment->_set('x', $cropX);
        $mockCropImageAdjustment->_set('y', $cropY);
        $mockCropImageAdjustment->_set('width', $cropWidth);
        $mockCropImageAdjustment->_set('height', $cropHeight);
        $mockCropImageAdjustment->refit($mockImage);
        $this->assertEquals($expectedX, $mockCropImageAdjustment->getX());
        $this->assertEquals($expectedY, $mockCropImageAdjustment->getY());
        $this->assertEquals($expectedWidth, $mockCropImageAdjustment->getWidth());
        $this->assertEquals($expectedHeight, $mockCropImageAdjustment->getHeight());
    }