Skip to content

Explicitly unset images during tearDown() #150

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,9 @@ private static function init(): void
self::$gobject = \FFI::cdef($gobject_decls, $gobject_libname);
self::$vips = \FFI::cdef($vips_decls, $vips_libname);

# Useful for debugging
# self::$vips->vips_leak_set(1);

# force the creation of some types we need
self::$vips->vips_blend_mode_get_type();
self::$vips->vips_interpretation_get_type();
Expand Down
6 changes: 6 additions & 0 deletions tests/ConvenienceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ protected function setUp(): void
$this->pixel = $this->image->getpoint(0, 0);
}

protected function tearDown(): void
{
unset($this->image);
unset($this->pixel);
}

public function testVipsBandjoin()
{
$image = Vips\Image::newFromArray([[1, 2, 3], [4, 5, 6]]);
Expand Down
11 changes: 5 additions & 6 deletions tests/ExceptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,15 @@ class ExceptionTest extends TestCase
*/
private $image;

/**
* The original value of pixel (0, 0).
*/
private $pixel;

protected function setUp(): void
{
$filename = __DIR__ . '/images/img_0076.jpg';
$this->image = Vips\Image::newFromFile($filename);
$this->pixel = $this->image->getpoint(0, 0);
}

protected function tearDown(): void
{
unset($this->image);
}

public function testVipsNewFromFileException()
Expand Down
6 changes: 6 additions & 0 deletions tests/MetaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ protected function setUp(): void
$this->png_image = Vips\Image::newFromFile($png_filename);
}

protected function tearDown(): void
{
unset($this->image);
unset($this->png_image);
}

public function testVipsSetGet()
{
$this->image->poop = 'banana';
Expand Down
6 changes: 6 additions & 0 deletions tests/ShortcutTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ protected function setUp(): void
$this->pixel = $this->image->getpoint(0, 0);
}

protected function tearDown(): void
{
unset($this->image);
unset($this->pixel);
}

public function testVipsPow()
{
$real = self::mapNumeric($this->pixel, function ($value) {
Expand Down