<?php
use PHPUnit\Framework\TestCase;
class Consecutive2Test extends TestCase
{
public function testIsBar() : void
{
$foo = $this->createFooMock();
$this->assertTrue($foo->isBar(true, true));
$this->assertTrue($foo->isBar(false, true));
$this->assertTrue($foo->isBar(true, false));
}
public function testIsBarWrongOrder() : void
{
$foo = $this->createFooMock();
$this->assertTrue($foo->isBar(false, true));
$this->assertTrue($foo->isBar(true, false));
$this->assertTrue($foo->isBar(true, true));
}
private function createFooMock()
{
$foo = $this->createMock(Foo::class);
$foo->expects($this->exactly(3))
->method('isBar')
->withConsecutive(
[true, true],
[false, true],
[true, false]
)
->willReturn(true);
return $foo;
}
}
class Foo
{
public function isBar($value1, $value2)
{
return $value1 || $value2;
}
}