SphericalDistanceTest.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Tests\Unit\Doctrine\OST\AST;
  4. use App\Doctrine\ORM\AST\SphericalDistance;
  5. use Doctrine\ORM\Query\AST\Node;
  6. use PHPUnit\Framework\MockObject\MockObject;
  7. use PHPUnit\Framework\TestCase;
  8. class TestableSphericalDistance extends SphericalDistance {
  9. public function getLongitude1(): Node|string
  10. {
  11. return $this->longitude1;
  12. }
  13. public function getLongitude2(): Node|string
  14. {
  15. return $this->longitude2;
  16. }
  17. public function getLatitude1(): Node|string
  18. {
  19. return $this->latitude1;
  20. }
  21. public function getLatitude2(): Node|string
  22. {
  23. return $this->latitude2;
  24. }
  25. }
  26. class SphericalDistanceTest extends TestCase
  27. {
  28. protected function getMockFor(string $methodName): TestableSphericalDistance|MockObject
  29. {
  30. return $this
  31. ->getMockBuilder(TestableSphericalDistance::class)
  32. ->setMethodsExcept([$methodName, 'getLongitude1', 'getLongitude2', 'getLatitude1', 'getLatitude2'])
  33. ->getMock();
  34. }
  35. // TODO: complete if possible (it's hard to test...)
  36. }