title: Phpunit mock only one method in tested class - using Mockery
body: <p>I'm learning phpunit since week. I don't have idea how to mock only one method from tested class. (it's example only so I didn't write namespaces). Maybe you can help me</p>
  
  <pre><code>class SomeService
  {
      public function firstMethod()
      {
          return 'smth';
      }
      public function secondMethd()
      {
          return $this-&gt;firstMethod() . ' plus some text example';
      }
  }
  </code></pre>
  
  <p>and test:</p>
  
  <pre><code>class SomeServiceUnitTest extends TestCase
  {
      private $someService;
  
      public function setUp()
      {
          parent::setUp();
          $this-&gt;someService = new SomeService();
      }
  
      public function tearDown()
      {
          $this-&gt;someService = null;
          parent::tearDown();
      }
  
      public function test_secondMethod()
      {
          $mock = Mockery::mock('App\Services\SomeService');
          $mock-&gt;shouldReceive('firstMethod')-&gt;andReturn('rerg');
          exit($this-&gt;walletService-&gt;secondMethd());
      }
  }
  </code></pre>