Skip to content

assertIsNotResource() and closed resources #4276

@alexpts

Description

@alexpts
Q A
PHPUnit version 9.2.1
PHP version 7.4.6
Installation Method Composer

Summary

After unlink variable of type resource assert assertIsNotResource detect value as resource.

Current behavior

IDE suggests to replace static::assertFalse to static::assertIsNotResource. I don`t know it is bug or specific. But it is not obvious for me.

How to reproduce

public function testUnlinkResource(): void
	{
		$resource = fopen('php://temp', 'r');
		fclose($resource);

		static::assertFalse(is_resource($resource)); // pass
		static::assertIsNotResource($resource); // not pass
	}

Expected behavior

public function testUnlinkResource(): void
	{
		$resource = fopen('php://temp', 'r');
		fclose($resource);

		static::assertFalse(is_resource($resource)); // pass
		static::assertIsNotResource($resource); // pass
	}

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature/assertionIssues related to assertions and expectationstype/bugSomething is broken

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions