optionsStub = $this->createMock(Options::class); $this->optionsStub->method('getUsername')->willReturn('Foo'); $this->optionsStub->method('getPassword')->willReturn('Bar'); $this->plainAuth = new Plain($this->optionsStub); } public function testIfCredentialsAreEncodedRight(): void { $this->assertEquals('AEZvbwBCYXI=', $this->plainAuth->encodedCredentials()); } }