Skip to content

Instantly share code, notes, and snippets.

@reinhurd
Created June 3, 2020 05:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reinhurd/30bffe1e4b8268f44d4f1372cb53ea9a to your computer and use it in GitHub Desktop.
Save reinhurd/30bffe1e4b8268f44d4f1372cb53ea9a to your computer and use it in GitHub Desktop.
Mock Yii AR props
//code to correct set AR props
//https://forum.yiiframework.com/t/how-to-mock-activerecord/83931
$attributes = (new TaskExpendableReceipt)->attributes();
$relations = ['receipt_date'];
$receiptMock = $this->getMockBuilder(TaskExpendableReceipt::class)
->setMethods(['attributes'])
->getMock();
$receiptMock->method('attributes')
->willReturn(array_merge($attributes, $relations));
$receiptDate = '20200423T1208';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment