mirror of
https://github.com/silverstripe/silverstripe-restfulserver
synced 2024-10-22 14:05:58 +02:00
API Use new names for renamed classes (#135)
This commit is contained in:
parent
76268db1d1
commit
62a47ff758
@ -7,7 +7,7 @@ use SilverStripe\Core\Config\Config;
|
|||||||
use SilverStripe\Core\Config\Configurable;
|
use SilverStripe\Core\Config\Configurable;
|
||||||
use SilverStripe\ORM\DataObject;
|
use SilverStripe\ORM\DataObject;
|
||||||
use SilverStripe\ORM\DataObjectInterface;
|
use SilverStripe\ORM\DataObjectInterface;
|
||||||
use SilverStripe\ORM\SS_List;
|
use SilverStripe\Model\List\SS_List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A DataFormatter object handles transformation of data from SilverStripe model objects to a particular output
|
* A DataFormatter object handles transformation of data from SilverStripe model objects to a particular output
|
||||||
|
@ -3,12 +3,12 @@
|
|||||||
namespace SilverStripe\RestfulServer\DataFormatter;
|
namespace SilverStripe\RestfulServer\DataFormatter;
|
||||||
|
|
||||||
use SilverStripe\RestfulServer\RestfulServer;
|
use SilverStripe\RestfulServer\RestfulServer;
|
||||||
use SilverStripe\View\ArrayData;
|
use SilverStripe\Model\ArrayData;
|
||||||
use SilverStripe\Core\Convert;
|
use SilverStripe\Core\Convert;
|
||||||
use SilverStripe\RestfulServer\DataFormatter;
|
use SilverStripe\RestfulServer\DataFormatter;
|
||||||
use SilverStripe\ORM\DataObjectInterface;
|
use SilverStripe\ORM\DataObjectInterface;
|
||||||
use SilverStripe\Control\Director;
|
use SilverStripe\Control\Director;
|
||||||
use SilverStripe\ORM\SS_List;
|
use SilverStripe\Model\List\SS_List;
|
||||||
use SilverStripe\ORM\FieldType;
|
use SilverStripe\ORM\FieldType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -10,7 +10,7 @@ use SilverStripe\RestfulServer\DataFormatter;
|
|||||||
use SilverStripe\ORM\DataObject;
|
use SilverStripe\ORM\DataObject;
|
||||||
use SilverStripe\ORM\DataObjectInterface;
|
use SilverStripe\ORM\DataObjectInterface;
|
||||||
use SilverStripe\Control\Director;
|
use SilverStripe\Control\Director;
|
||||||
use SilverStripe\ORM\SS_List;
|
use SilverStripe\Model\List\SS_List;
|
||||||
use SilverStripe\RestfulServer\RestfulServer;
|
use SilverStripe\RestfulServer\RestfulServer;
|
||||||
use InvalidArgumentException;
|
use InvalidArgumentException;
|
||||||
|
|
||||||
|
@ -8,12 +8,12 @@ use SilverStripe\Control\Director;
|
|||||||
use SilverStripe\Control\HTTPRequest;
|
use SilverStripe\Control\HTTPRequest;
|
||||||
use SilverStripe\Core\Config\Config;
|
use SilverStripe\Core\Config\Config;
|
||||||
use SilverStripe\Core\Injector\Injector;
|
use SilverStripe\Core\Injector\Injector;
|
||||||
use SilverStripe\ORM\ArrayList;
|
use SilverStripe\Model\List\ArrayList;
|
||||||
use SilverStripe\ORM\DataList;
|
use SilverStripe\ORM\DataList;
|
||||||
use SilverStripe\ORM\DataObject;
|
use SilverStripe\ORM\DataObject;
|
||||||
use SilverStripe\ORM\SS_List;
|
use SilverStripe\Model\List\SS_List;
|
||||||
use SilverStripe\ORM\ValidationException;
|
use SilverStripe\Core\Validation\ValidationException;
|
||||||
use SilverStripe\ORM\ValidationResult;
|
use SilverStripe\Core\Validation\ValidationResult;
|
||||||
use SilverStripe\Security\Member;
|
use SilverStripe\Security\Member;
|
||||||
use SilverStripe\Security\Security;
|
use SilverStripe\Security\Security;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace SilverStripe\RestfulServer;
|
namespace SilverStripe\RestfulServer;
|
||||||
|
|
||||||
use SilverStripe\ORM\SS_List;
|
use SilverStripe\Model\List\SS_List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Restful server handler for a single DataObject
|
* Restful server handler for a single DataObject
|
||||||
|
@ -20,6 +20,7 @@ use SilverStripe\Dev\SapphireTest;
|
|||||||
use SilverStripe\RestfulServer\DataFormatter\JSONDataFormatter;
|
use SilverStripe\RestfulServer\DataFormatter\JSONDataFormatter;
|
||||||
use Page;
|
use Page;
|
||||||
use SilverStripe\Core\Config\Config;
|
use SilverStripe\Core\Config\Config;
|
||||||
|
use SilverStripe\Core\Validation\ValidationException;
|
||||||
use SilverStripe\RestfulServer\DataFormatter\XMLDataFormatter;
|
use SilverStripe\RestfulServer\DataFormatter\XMLDataFormatter;
|
||||||
|
|
||||||
class RestfulServerTest extends SapphireTest
|
class RestfulServerTest extends SapphireTest
|
||||||
@ -204,7 +205,7 @@ class RestfulServerTest extends SapphireTest
|
|||||||
$url = "{$this->baseURI}/api/v1/$urlSafeClassname/" . $author4->ID . '/RelatedAuthors';
|
$url = "{$this->baseURI}/api/v1/$urlSafeClassname/" . $author4->ID . '/RelatedAuthors';
|
||||||
$response = Director::test($url, null, null, 'GET');
|
$response = Director::test($url, null, null, 'GET');
|
||||||
$this->assertEquals(200, $response->getStatusCode());
|
$this->assertEquals(200, $response->getStatusCode());
|
||||||
|
|
||||||
$formatter = new XMLDataFormatter();
|
$formatter = new XMLDataFormatter();
|
||||||
$arr = $formatter->convertStringToArray($response->getBody());
|
$arr = $formatter->convertStringToArray($response->getBody());
|
||||||
$xmlSafeClassName = $this->urlSafeClassname(RestfulServerTestAuthor::class);
|
$xmlSafeClassName = $this->urlSafeClassname(RestfulServerTestAuthor::class);
|
||||||
@ -747,7 +748,7 @@ class RestfulServerTest extends SapphireTest
|
|||||||
// Assumption: XML is default output
|
// Assumption: XML is default output
|
||||||
$formatter = new XMLDataFormatter();
|
$formatter = new XMLDataFormatter();
|
||||||
$responseArr = $formatter->convertStringToArray($response->getBody());
|
$responseArr = $formatter->convertStringToArray($response->getBody());
|
||||||
$this->assertEquals('SilverStripe\\ORM\\ValidationException', $responseArr['type']);
|
$this->assertEquals(ValidationException::class, $responseArr['type']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testExceptionThrownWithPOST()
|
public function testExceptionThrownWithPOST()
|
||||||
|
@ -24,7 +24,7 @@ class RestfulServerTestValidationFailure extends DataObject implements TestOnly
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return \SilverStripe\ORM\ValidationResult
|
* @return \SilverStripe\Core\Validation\ValidationResult
|
||||||
*/
|
*/
|
||||||
public function validate()
|
public function validate()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user