SphericalDistanceTest.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. {
  10. public function getLongitude1(): Node|string
  11. {
  12. return $this->longitude1;
  13. }
  14. public function getLongitude2(): Node|string
  15. {
  16. return $this->longitude2;
  17. }
  18. public function getLatitude1(): Node|string
  19. {
  20. return $this->latitude1;
  21. }
  22. public function getLatitude2(): Node|string
  23. {
  24. return $this->latitude2;
  25. }
  26. }
  27. class SphericalDistanceTest extends TestCase
  28. {
  29. protected function getMockFor(string $methodName): TestableSphericalDistance|MockObject
  30. {
  31. return $this
  32. ->getMockBuilder(TestableSphericalDistance::class)
  33. ->setMethodsExcept([$methodName, 'getLongitude1', 'getLongitude2', 'getLatitude1', 'getLatitude2'])
  34. ->getMock();
  35. }
  36. // TODO: complete if possible (it's hard to test...)
  37. }