createMock( RealTempUserConfig::class ); $mockTempUserConfig->expects( $this->once() ) ->method( $methodName ) ->with( ...$mockArguments ); $objectUnderTest = $this->newServiceInstance( TempUserCreator::class, [ 'config' => $mockTempUserConfig ] ); $objectUnderTest->$methodName( ...$mockArguments ); } public static function providePassThroughMethods() { return [ 'isEnabled' => [ 'isEnabled' ], 'isAutoCreateAction' => [ 'isAutoCreateAction', [ 'mock-action' ] ], 'isTempName' => [ 'isTempName', [ 'mock-name' ] ], 'isReservedName' => [ 'isReservedName', [ 'mock-name' ] ], 'getPlaceholderName' => [ 'getPlaceholderName' ], 'getMatchPattern' => [ 'getMatchPattern' ], 'getMatchPatterns' => [ 'getMatchPatterns' ], 'getExpireAfterDays' => [ 'getExpireAfterDays' ], 'getNotifyBeforeExpirationDays' => [ 'getNotifyBeforeExpirationDays' ], ]; } public function testShouldAutoCreate() { $this->testPassThroughMethods( 'shouldAutocreate', [ $this->createMock( Authority::class ), 'mock-action' ] ); } }