title: Can you check how many times a function is called without getMock in PHPUnit
body: <p>My test suite calls <code>accepted</code> in Object A. That function will then call <code>insert</code> for Object B a certain number of times, depending on which test I'm running.</p>
  
  <p>I want to verify that <code>insert</code> is being called the right amount of times in each test. I don't <em>think</em> I can count it using mock since Object A wouldn't be hitting the mock within my test.</p>
  
  <p>I saw this question from 2 years ago:
  <a href="https://stackoverflow.com/questions/3809260/phpunit-test-how-many-times-a-function-is-called">PHPUnit Test How Many Times A Function Is Called</a></p>
  
  <p>Using a global variable for counting isn't ideal since I shouldn't have code in my class that is specifically for a class.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>It would probably be helpful to note that <code>insert</code> is static. Even if I mock the class and specify I only want to mock that function, it still calls <code>new</code> on the mocked object which is another roadblock I'm facing.</p>
  
  <p><strong>ANSWER</strong>
  The answer is no. I just want @zerkms to give that answer since he was the one helping me so I can accept it.</p>
  
  <p>I ended up figuring I can use just one object but did hit another roadblock:
  <a href="https://stackoverflow.com/questions/10537100/why-isnt-phpunit-counting-this-function-as-having-ran">Why isn&#39;t PHPUnit counting this function as having ran?</a></p>