cs: Fix code style (safe rules only).

This commit is contained in:
Pol Dellaiera
2021-11-23 14:06:38 +01:00
parent 149d7ce991
commit 8f96a1121d
1223 changed files with 65199 additions and 64625 deletions

View File

@@ -1,49 +1,73 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\MainBundle\Tests\Doctrine\Model;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Chill\MainBundle\Doctrine\Model\Point;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
/**
* Test the point model methods
* Test the point model methods.
*
* @author Julien Minet <julien.minet@champs-libres.coop>
* @internal
* @coversNothing
*/
class ExportControllerTest extends KernelTestCase
{
public function testToWKT()
public function testFromArrayGeoJson()
{
$array = [
'type' => 'Point',
'coordinates' => [4.8634, 50.47382],
];
$lon = 4.8634;
$lat = 50.47382;
$point = $this->preparePoint($lon, $lat);
$this->assertEquals($point->toWKT(),'SRID=4326;POINT(4.8634 50.47382)');
$this->assertEquals($point, Point::fromArrayGeoJson($array));
}
public function testToGeojson()
public function testFromGeoJson()
{
$geojson = '{"type":"Point","coordinates":[4.8634,50.47382]}';
$lon = 4.8634;
$lat = 50.47382;
$point = $this->preparePoint($lon, $lat);
$this->assertEquals($point->toGeoJson(),'{"type":"Point","coordinates":[4.8634,50.47382]}');
$this->assertEquals($point, Point::fromGeoJson($geojson));
}
public function testToArrayGeoJson()
public function testFromLonLat()
{
$lon = 4.8634;
$lat = 50.47382;
$point = $this->preparePoint($lon, $lat);
$this->assertEquals(
$point->toArrayGeoJson(),
[
'type' => 'Point',
'coordinates' => [4.8634, 50.47382]
]
);
$this->assertEquals($point, Point::fromLonLat($lon, $lat));
}
public function testGetLat()
{
$lon = 4.8634;
$lat = 50.47382;
$point = $this->preparePoint($lon, $lat);
$this->assertEquals($lat, $point->getLat());
}
public function testGetLon()
{
$lon = 4.8634;
$lat = 50.47382;
$point = $this->preparePoint($lon, $lat);
$this->assertEquals($lon, $point->getLon());
}
public function testJsonSerialize()
@@ -56,64 +80,46 @@ class ExportControllerTest extends KernelTestCase
$point->jsonSerialize(),
[
'type' => 'Point',
'coordinates' => [4.8634, 50.47382]
'coordinates' => [4.8634, 50.47382],
]
);
}
public function testFromGeoJson()
public function testToArrayGeoJson()
{
$geojson = '{"type":"Point","coordinates":[4.8634,50.47382]}';
$lon = 4.8634;
$lat = 50.47382;
$point = $this->preparePoint($lon, $lat);;
$point = $this->preparePoint($lon, $lat);
$this->assertEquals($point, Point::fromGeoJson($geojson));
$this->assertEquals(
$point->toArrayGeoJson(),
[
'type' => 'Point',
'coordinates' => [4.8634, 50.47382],
]
);
}
public function testFromLonLat()
public function testToGeojson()
{
$lon = 4.8634;
$lat = 50.47382;
$point = $this->preparePoint($lon, $lat);;
$point = $this->preparePoint($lon, $lat);
$this->assertEquals($point, Point::fromLonLat($lon, $lat));
$this->assertEquals($point->toGeoJson(), '{"type":"Point","coordinates":[4.8634,50.47382]}');
}
public function testFromArrayGeoJson()
{
$array = [
'type' => 'Point',
'coordinates' => [4.8634, 50.47382]
];
$lon = 4.8634;
$lat = 50.47382;
$point = $this->preparePoint($lon, $lat);;
$this->assertEquals($point, Point::fromArrayGeoJson($array));
}
public function testGetLat()
public function testToWKT()
{
$lon = 4.8634;
$lat = 50.47382;
$point = $this->preparePoint($lon, $lat);;
$point = $this->preparePoint($lon, $lat);
$this->assertEquals($lat, $point->getLat());
}
public function testGetLon()
{
$lon = 4.8634;
$lat = 50.47382;
$point = $this->preparePoint($lon, $lat);;
$this->assertEquals($lon, $point->getLon());
$this->assertEquals($point->toWKT(), 'SRID=4326;POINT(4.8634 50.47382)');
}
private function preparePoint($lon, $lat)
{
return Point::fromLonLat($lon, $lat);
}
}