/** * @covers ::getGroups */ public function testGetGroups() { $groups = ['FOO' => 'BAR']; // Use PHPUnit for mocking, because Prophecy cannot mock methods that return // by reference. See \Prophecy\Doubler\Generator\Node::getCode(). $decorated_form_state = $this->getMock(FormStateInterface::class); $decorated_form_state->expects($this->once())->method('getGroups')->willReturn($groups); $this->formStateDecoratorBase = new NonAbstractFormStateDecoratorBase($decorated_form_state); $this->assertSame($groups, $this->formStateDecoratorBase->getGroups()); }