Skip to content

Why expect function works unexpectedly? #88

@wppunk

Description

@wppunk

When I run this code:

expect( 'func_1' )
	->once()
	->with( 'krya' )
	->andReturn( 'krya' );

$this->assertSame( 'krya', func_1( 'ne-krya' ) );

Result: Failed asserting that null is identical to 'krya'.. It looks well.

But when I run this code:

expect( 'func_1' )
	->with( 'krya' )
	->once()
	->andReturn( 'krya' );

$this->assertSame( 'krya', func_1( 'ne-krya' ) );

OK (1 test, 1 assertion)

Works but why?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions