Unit test returning injected object
<p>I have a basic class which I inject into another class</p>

<pre><code>AClass
{
    protected $thing;

    public function setThing($thing)
    {
        $this-&gt;thing = $thing;
    }

    public function getThing() 
    {
        return $this-&gt;thing;
    }
}
</code></pre>

<p>This class is the SUT.</p>

<pre><code>AnotherClass
{
    protected $aClass; 

    protected $someOtherClass;

    __construct(AClass $aClass, SomeOtherClass $someOtherClass)
    {
        $this-&gt;aClass = $aClass;
        $this-&gt;someOtherClass = $someOtherClass;
    }

    public function thatImTesting()
    {
         ...
         $thing = "logic from {$this-&gt;someOtherClass} and some other stuff";

         return $this-&gt;aClass-&gt;setThing($thing);
    }
}
</code></pre>

<p>So I want to test <code>AnotherClass</code> so I mock <code>SomeOtherClass</code> and inject it into the SUT. However, I create a new <code>AClass</code> and inject it in because I don't want to mock the functions (as that would make no sense).</p>

<pre><code>$someOtherClassMock = m::mock(SomeOtherClass::class, [
    // mocking the functions here
]);
$aClass = new AClass();
$anotherClass = new AnotherClass($aClass, $someOtherClassMock);

$this-&gt;assertEquals('Something', $anotherClass-&gt;getThing());
</code></pre>

<p>As <code>$anotherClass</code> object is returned and I need to call a function to check the data in the test, is this still a unit test?</p>