Mocking single function in class is still running that function - Phpunit 8.2

I am trying to mock a function that is called inside one of my tests. It checks config and makes a call out but for unit tests we dont set the config values or allow calls out of our code.

Class with Function that needs to be mocked

 class MyClass {
    public __constructor($a, $b){
      //some code
    }
    public function functionA($a){
      //some code
      $this->functionThatNeedsMock($value);
    }
    public function functionThatNeedsMock($b){
      //throws error if config is missing or if it can't reach the external website
      return $aString;
    }
 }

Unit test:

    $stub = $this->createMock(MyClass::class);
    $stub->method('functionThatNeedsMock')->willReturn('abc');

    $uri = 'uri/here';
    $response = $this->asWebUser($user, new WebEndpointConfigure())->postJson($uri, ["message" => "foo"]);

    $this->assertResponseOk($response);

I want to just bypass the whole function and whenever that function gets called in the test i want it to just use the mock that returns a string without actually running that function.

We are behind in phpunit using 8.2