You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
981 B

2 years ago
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: x
  5. * Date: 2018/12/9
  6. * Time: 11:10 PM
  7. */
  8. namespace Tests\Feature;
  9. use QL\QueryList;
  10. use Tests\TestCaseBase;
  11. class InstanceTest extends TestCaseBase
  12. {
  13. protected $html;
  14. protected function setUp(): void
  15. {
  16. $this->html = $this->getSnippet('snippet-1');
  17. }
  18. /**
  19. * @test
  20. */
  21. public function singleton_instance_mode()
  22. {
  23. $ql = QueryList::getInstance()->html($this->html);
  24. $ql2 = QueryList::getInstance();
  25. $this->assertEquals($ql->getHtml(),$ql2->getHtml());
  26. }
  27. /**
  28. * @test
  29. */
  30. public function get_new_object()
  31. {
  32. $ql = (new QueryList())->html($this->html);
  33. $ql2 = (new QueryList())->html('');
  34. $this->assertNotEquals($ql->getHtml(),$ql2->getHtml());
  35. $ql = QueryList::range('')->html($this->html);
  36. $ql2 = QueryList::range('')->html('');
  37. $this->assertNotEquals($ql->getHtml(),$ql2->getHtml());
  38. }
  39. }