Error using Mockery/phpUnit in Laravel
<p>I'm a novice developer trying to get a test suite started for an existing laravel app but I have not experience in testing.  Right now I'm just trying to get some tests built out to get some confidence and experience to write more substantial tests.  I'm trying to test a relationship on a model(I realize it's not a very sensible tests) and trying to create a mocked model object to do so(I also understand it's better to do this in memory in a sqlite db but the major goal here is to test the controllers but I don't know how to deal with the authentication issue there).  I have the following simple, stupid test:</p>

<pre><code>public function testFoo()
{
    $lead = m::mock('Lead');

    $this-&gt;mock-&gt;shouldReceive('program')-&gt;once();

    $this-&gt;assertEquals($lead-&gt;program_id, $lead-&gt;program-&gt;id);
}
</code></pre>

<p>But I get the following error:</p>

<pre><code>LeadTest::testFoo
BadMethodCallException: Received Mockery_0_Lead::getAttribute(), but no expectations were specified
</code></pre>

<p>I don't understand what this error is trying to tell me and I'm finding no help googling the issue or reading through the docs I can find.</p>

<p>I assume I'm not setting the expected return values but this is a pretty general test and it doesn't seem right to hard code expected return values.  What am I missing here?</p>

<p>I'm just testing a Laravel relationship to make sure I have things set up/implemented correctly:</p>

<pre><code>public function program()
{
    return $this-&gt;belongsTo('Program');
}
</code></pre>