<?php
use PHPUnit\Framework\TestCase;
class Foo
{
public function prependAwesomeTo($str) : string
{
return 'Awesome' . $str;
}
}
class ValueMapTest extends TestCase
{
public function testPrependAwesomeTo() : void
{
// last value in every array is return value
$map = [
['Cat', 'AwesomeCat'],
['Dog', 'AwesomeDog'],
['Bird', 'AwesomeBird'],
];
$foo = $this->createMock('Foo');
$foo->expects($this->atLeastOnce())
->method('prependAwesomeTo')
->will($this->returnValueMap($map));
$this->assertEquals('AwesomeCat', $foo->prependAwesomeTo('Cat'));
$this->assertEquals('AwesomeBird', $foo->prependAwesomeTo('Bird'));
$this->assertEquals('AwesomeDog', $foo->prependAwesomeTo('Dog'));
}
}