Created
June 3, 2020 05:26
-
-
Save reinhurd/30bffe1e4b8268f44d4f1372cb53ea9a to your computer and use it in GitHub Desktop.
Mock Yii AR props
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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