SysMessageTest.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * This file is part of Hyperf.
  5. *
  6. * @link https://www.hyperf.io
  7. * @document https://hyperf.wiki
  8. * @contact group@hyperf.io
  9. * @license https://github.com/hyperf/hyperf/blob/master/LICENSE
  10. */
  11. namespace HyperfTest\Cases;
  12. use App\Model\SysMessageModel;
  13. use Carbon\Carbon;
  14. use HyperfTest\HttpTestCase;
  15. /**
  16. * @internal
  17. * @coversNothing
  18. */
  19. class SysMessageTest extends HttpTestCase
  20. {
  21. public function setUp(): void
  22. {
  23. parent::setUp(); // TODO: Change the autogenerated stub
  24. }
  25. public function tearDown(): void
  26. {
  27. parent::tearDown(); // TODO: Change the autogenerated stub
  28. }
  29. public function testCreateOne()
  30. {
  31. $setarr = [
  32. 'subject' => '',
  33. 'struct_type' => 'text',
  34. 'content' => [
  35. 'text' => '一段话而已',
  36. ],
  37. 'expired_at' => Carbon::now()->addMonths(1)->toDateTimeString(),
  38. ];
  39. // for ($i = 0; $i < 100; $i++) {
  40. // $setarr['subject'] = 'i_'. strval($i) . '_'. random(10);
  41. // $obj = SysMessageModel::query()->create($setarr);
  42. // }
  43. $obj = SysMessageModel::query()->create($setarr);
  44. var_dump($obj->toArray());
  45. $this->assertTrue(true);
  46. }
  47. }