FieldNameEQFunctionNameTest.php 641 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. /**
  3. * 表字段有ORM函数同名,测试取出数据(修复前getAttr有bug 会当成关联查询)
  4. * User: Siam
  5. * Date: 2019/12/16
  6. * Time: 15:27
  7. */
  8. namespace EasySwoole\ORM\Tests;
  9. use PHPUnit\Framework\TestCase;
  10. use EasySwoole\ORM\Tests\models\TestFunctionFieldNameModel;
  11. class FieldNameEQFunctionNameTest extends TestCase
  12. {
  13. public function testOrder()
  14. {
  15. $model = TestFunctionFieldNameModel::create()->data([
  16. 'name' => 'siam',
  17. 'order' => 1,
  18. 'age' => 21,
  19. ]);
  20. $this->assertEquals('{"name":"siam","order":"1","age":21}', json_encode($model));
  21. }
  22. }