"Couldn't find object" error with Silverstripe 4 unit testing, how to fixed it?.
with silverstripe 4 unit test, im getting a error "Couldn't find object 'transaction1' ". can anyone suggest what's happening here?. Thanks.
class CustomerCreditTransactionTest extends SapphireTest
{
protected static $fixture_file = BASE_PATH.'/mysite/code/CustomerCreditTransactionTest.yml';
/**
* @var string
*/
protected $readingmode = null;
/**
* Default reading mode
*
* @var string
*/
protected $defaultMode = null;
public function setUp()
{
$this->readingmode = 'Original';
$this->defaultMode = 'Original';
}
public function tearDown()
{
MirroredData::SetCurrentReadingStage($this->readingmode);
MirroredData::SetDefaultWritingStage($this->defaultMode);
}
public function testCustomerName()
{
$obj = $this->objFromFixture(CustomerCreditTransaction::class, 'transaction1');
$this->assertEquals(
'John@gmail.com',
$obj->CustomerName(),
'customer name is : '.$obj->CustomerName()
);
}
}