title: Undefined method on mock object implementing a given interface in PHPUnit?
body: <p>I'm new to unit testing and PHPUnit.</p>
  
  <p>I need a mock, on which I have a full control, implementing <code>ConfigurationInterface</code> interface. Test subject is <code>ReportEventParamConverter</code> object and test must check the interaction between my object and the interface.</p>
  
  <p><code>ReportEventParamConverter</code> object (here simplified):</p>
  
  
  
  <pre class="lang-php prettyprint-override"><code>class ReportEventParamConverter implements ParamConverterInterface
  {
      /**
       * @param Request $request
       * @param ConfigurationInterface $configuration
       */
      function apply(Request $request, ConfigurationInterface $configuration)
      {
          $request-&gt;attributes-&gt;set($configuration-&gt;getName(), $reportEvent);
      }
  
      /**
       * @param ConfigurationInterface $configuration
       * @return bool
       */
      function supports(ConfigurationInterface $configuration)
      {
          return 'My\Namespaced\Class' === $configuration-&gt;getClass();
      }
  }
  </code></pre>
  
  <p>And this is the way I'm trying to mock the interface:</p>
  
  <pre class="lang-php prettyprint-override"><code>$cls = 'Sensio\Bundle\FrameworkExtraBundle\Configuration\ConfigurationInterface';
  $mock = $this-&gt;getMock($mockCls);
  </code></pre>
  
  <p>I need to simulate the returned values for two methods: <code>getClass()</code> and <code>getName()</code>. For example:</p>
  
  <pre class="lang-php prettyprint-override"><code>$mock-&gt;expects($this-&gt;any())
      -&gt;method('getClass')
      -&gt;will($this-&gt;returnValue('Some\Other\Class'))
  ;
  </code></pre>
  
  <p>When i create a new <code>ReportEventParamConverter</code> and test <code>supports()</code> method, i get the following PHPUnit error:</p>
  
  <blockquote>
    <p>Fatal error: Call to undefined method
    Mock_ConfigurationInterface_21e9dccf::getClass().</p>
  </blockquote>
  
  <pre class="lang-php prettyprint-override"><code>$converter = new ReportEventParamConverter();
  $this-&gt;assertFalse($converter-&gt;supports($mock));
  </code></pre>