JsonArrayTest.php 873 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace EasySwoole\DoctrineAnnotation\Tests;
  3. use EasySwoole\DoctrineAnnotation\AnnotationReader;
  4. use PHPUnit\Framework\TestCase;
  5. use EasySwoole\DoctrineAnnotation\Tests\Tag\PropertyTag;
  6. class JsonArrayTest extends TestCase
  7. {
  8. /**
  9. * @PropertyTag(input={"code":2,"result":[{"name":1}]})
  10. */
  11. private $jsonArray;
  12. private $ref;
  13. private $reader;
  14. function __construct($name = null, array $data = [], $dataName = '')
  15. {
  16. $t = new PropertyTag();
  17. $this->ref = new \ReflectionClass(static::class);
  18. $this->reader = new AnnotationReader();
  19. parent::__construct($name, $data, $dataName);
  20. }
  21. function testJsonArray()
  22. {
  23. $ret = $this->reader->getPropertyAnnotations($this->ref->getProperty('jsonArray'));
  24. $this->assertEquals(['code'=>2,'result'=>[['name'=>1]]],$ret[0]->input);
  25. }
  26. }