I'm following this tutorial for unit testing on ZF2. I'm familiar with unit testing, so I pretty much understand what's going on.
I'm getting a PHP Fatal error: Call to undefined method Mock_AlbumTable_9fb22412::fetchAll() in [my controller's route here]
.
If I'm following correctly, the controller calls fetchAll
on my mock object. The weird part is why is it undefined, if I declared it in the mock expectations.
My test code is exactly the same on the link provided, (Literally copy/pasted), and my AlbumTable
class is also from the tutorial:
<?php
namespace Album\Model;
use Zend\Db\TableGateway\TableGateway;
class AlbumTable
{
protected $tableGateway;
public function __construct(TableGateway $tableGateway)
{
$this->tableGateway = $tableGateway;
}
public function fetchAll()
{
$resultSet = $this->tableGateway->select();
return $resultSet;
}
// ... more code ...
}
What am I missing here?
Aucun commentaire:
Enregistrer un commentaire