Skip to content

Commit

Permalink
Deprecation warnings in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SharkyKZ committed Aug 7, 2019
1 parent 68c28b6 commit 48b5aed
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 37 deletions.
4 changes: 2 additions & 2 deletions tests/Unit/Libraries/Cms/Image/ImageFilterTest.php
Expand Up @@ -49,11 +49,11 @@ protected function setUp(): void
* @return void
*
* @since __DEPLOY_VERSION__
*
* @expectedException InvalidArgumentException
*/
public function testConstructorInvalidArgument()
{
$this->expectException(\InvalidArgumentException::class);

$filter = new FilterBrightness('test');
}

Expand Down
63 changes: 34 additions & 29 deletions tests/Unit/Libraries/Cms/Image/ImageTest.php
Expand Up @@ -257,11 +257,11 @@ public function testloadFilePng()
*
* @covers Joomla\CMS\Image\Image::loadFile
* @since __DEPLOY_VERSION__
*
* @expectedException InvalidArgumentException
*/
public function testloadFileBmp()
{
$this->expectException(\InvalidArgumentException::class);

// Get a new Image inspector.
$image = new ImageInspector;
$image->loadFile($this->testFileBmp);
Expand All @@ -275,11 +275,12 @@ public function testloadFileBmp()
* @return void
*
* @covers Joomla\CMS\Image\Image::loadFile
* @expectedException InvalidArgumentException
* @since __DEPLOY_VERSION__
*/
public function testloadFileWithInvalidFile()
{
$this->expectException(\InvalidArgumentException::class);

// Get a new Image inspector.
$image = new ImageInspector;
$image->loadFile('bogus_file');
Expand Down Expand Up @@ -356,11 +357,11 @@ public function testResizeTransparent()
* @covers Joomla\CMS\Image\Image::resize
*
* @since __DEPLOY_VERSION__
*
* @expectedException LogicException
*/
public function testResizeNoFile()
{
$this->expectException(\LogicException::class);

// Get a new Image inspector.
$image = new ImageInspector;

Expand Down Expand Up @@ -399,14 +400,14 @@ public function testCropResize()
*
* @return void
*
* @expectedException LogicException
*
* @covers Joomla\CMS\Image\Image::toFile
*
* @since __DEPLOY_VERSION__
*/
public function testToFileInvalid()
{
$this->expectException(\LogicException::class);

$outFileGif = __DIR__ . '/tmp/out.gif';

$image = new ImageInspector;
Expand Down Expand Up @@ -624,14 +625,14 @@ public function testGetHeight()
*
* @return void
*
* @expectedException LogicException
*
* @covers Joomla\CMS\Image\Image::getHeight
*
* @since __DEPLOY_VERSION__
*/
public function testGetHeightWithoutLoadedImage()
{
$this->expectException(\LogicException::class);

// Create a new Image object without loading an image.
$image = new Image;

Expand Down Expand Up @@ -669,14 +670,14 @@ public function testGetWidth()
*
* @return void
*
* @expectedException LogicException
*
* @covers Joomla\CMS\Image\Image::getWidth
*
* @since __DEPLOY_VERSION__
*/
public function testGetWidthWithoutLoadedImage()
{
$this->expectException(\LogicException::class);

// Create a new Image object without loading an image.
$image = new Image;

Expand All @@ -688,14 +689,14 @@ public function testGetWidthWithoutLoadedImage()
*
* @return void
*
* @expectedException InvalidArgumentException
*
* @covers Joomla\CMS\Image\Image::getImageFileProperties
*
* @since __DEPLOY_VERSION__
*/
public function testGetImageFilePropertiesWithInvalidFile()
{
$this->expectException(\InvalidArgumentException::class);

Image::getImageFileProperties(__DIR__ . '/suite/joomla/image/stubs/bogus.image');
}

Expand All @@ -704,11 +705,12 @@ public function testGetImageFilePropertiesWithInvalidFile()
*
* @return void
*
* @expectedException LogicException
* @since 1.1.3
*/
public function testGenerateThumbsWithoutLoadedImage()
{
$this->expectException(\LogicException::class);

// Create a new Image object without loading an image.
$image = new Image;

Expand All @@ -720,11 +722,12 @@ public function testGenerateThumbsWithoutLoadedImage()
*
* @return void
*
* @expectedException InvalidArgumentException
* @since 1.1.3
*/
public function testGenerateThumbsWithInvalidSize()
{
$this->expectException(\InvalidArgumentException::class);

// Create a new Image object without loading an image.
$image = new Image;
$image->loadFile($this->testFile);
Expand Down Expand Up @@ -787,11 +790,12 @@ public function testGenerateThumbs()
*
* @return void
*
* @expectedException LogicException
* @since 1.1.3
*/
public function testCreateThumbsWithoutLoadedImage()
{
$this->expectException(\LogicException::class);

// Create a new Image object without loading an image.
$image = new Image;

Expand All @@ -803,11 +807,12 @@ public function testCreateThumbsWithoutLoadedImage()
*
* @return void
*
* @expectedException InvalidArgumentException
* @since 1.1.3
*/
public function testGenerateThumbsWithInvalidFolder()
{
$this->expectException(\InvalidArgumentException::class);

// Create a new Image object without loading an image.
$image = new Image;
$image->loadFile($this->testFile);
Expand Down Expand Up @@ -851,14 +856,14 @@ public function testCreateThumbs()
*
* @return void
*
* @expectedException LogicException
*
* @covers Joomla\CMS\Image\Image::isTransparent
*
* @since __DEPLOY_VERSION__
*/
public function testIsTransparentWithoutLoadedImage()
{
$this->expectException(\LogicException::class);

// Create a new Image object without loading an image.
$image = new Image;

Expand Down Expand Up @@ -921,12 +926,12 @@ public function testOpaqueIsNotTransparent()
*
* @covers Joomla\CMS\Image\Image::crop
*
* @expectedException LogicException
*
* @since __DEPLOY_VERSION__
*/
public function testCropWithoutLoadedImage()
{
$this->expectException(\LogicException::class);

// Create a new Image object without loading an image.
$image = new Image;

Expand Down Expand Up @@ -1057,14 +1062,14 @@ public function testCrop($startHeight, $startWidth, $cropHeight, $cropWidth, $cr
*
* @return void
*
* @expectedException LogicException
*
* @covers Joomla\CMS\Image\Image::rotate
*
* @since __DEPLOY_VERSION__
*/
public function testRotateWithoutLoadedImage()
{
$this->expectException(\LogicException::class);

// Create a new Image object without loading an image.
$image = new Image;

Expand Down Expand Up @@ -1162,12 +1167,12 @@ public function testFilter()
*
* @covers Joomla\CMS\Image\Image::filter
*
* @expectedException LogicException
*
* @since __DEPLOY_VERSION__
*/
public function testFilterWithoutLoadedImage()
{
$this->expectException(\LogicException::class);

// Create a new Image object without loading an image.
$image = new Image;

Expand All @@ -1179,14 +1184,14 @@ public function testFilterWithoutLoadedImage()
*
* @return void
*
* @expectedException RuntimeException
*
* @covers Joomla\CMS\Image\Image::filter
*
* @since __DEPLOY_VERSION__
*/
public function testFilterWithInvalidFilterType()
{
$this->expectException(\RuntimeException::class);

// Create a new ImageInspector object.
$image = new ImageInspector(imagecreatetruecolor(10, 10));

Expand Down Expand Up @@ -1232,14 +1237,14 @@ public function testPrepareDimensions($inputHeight, $inputWidth, $inputScale, $i
*
* @return void
*
* @expectedException InvalidArgumentException
*
* @covers Joomla\CMS\Image\Image::prepareDimensions
*
* @since __DEPLOY_VERSION__
*/
public function testPrepareDimensionsWithInvalidScale()
{
$this->expectException(\InvalidArgumentException::class);

// Create a image handle of the correct size.
$imageHandle = imagecreatetruecolor(100, 100);

Expand Down
Expand Up @@ -102,11 +102,11 @@ public function testExecute()
*
* @covers Joomla\CMS\Image\Filter\Backgroundfill::execute
* @since __DEPLOY_VERSION__
*
* @expectedException InvalidArgumentException
*/
public function testExecuteInvalidArgument()
{
$this->expectException(\InvalidArgumentException::class);

// Create a image handle of the correct size.
$imageHandle = imagecreatetruecolor(100, 100);

Expand Down
Expand Up @@ -83,11 +83,11 @@ public function testExecute()
* @return void
*
* @since __DEPLOY_VERSION__
*
* @expectedException InvalidArgumentException
*/
public function testExecuteInvalidArgument()
{
$this->expectException(\InvalidArgumentException::class);

// Create a image handle of the correct size.
$imageHandle = imagecreatetruecolor(100, 100);

Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Libraries/Cms/Image/filter/FilterContrastTest.php
Expand Up @@ -84,11 +84,11 @@ public function testExecute()
* @return void
*
* @since __DEPLOY_VERSION__
*
* @expectedException InvalidArgumentException
*/
public function testExecuteInvalidArgument()
{
$this->expectException(\InvalidArgumentException::class);

// Create a image handle of the correct size.
$imageHandle = imagecreatetruecolor(100, 100);

Expand Down

0 comments on commit 48b5aed

Please sign in to comment.