mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
FIX: ensure RestfulServiceTest uses email as the unique identifer field for running tests. Fixes: #6156.
This commit is contained in:
parent
168663657b
commit
4977318f46
@ -1,7 +1,31 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @package framework
|
||||||
|
* @subpackage tests
|
||||||
|
*/
|
||||||
class RestfulServiceTest extends SapphireTest {
|
class RestfulServiceTest extends SapphireTest {
|
||||||
|
|
||||||
|
protected $member_unique_identifier_field = '';
|
||||||
|
|
||||||
|
function setUp() {
|
||||||
|
// backup the project unique identifier field
|
||||||
|
$this->member_unique_identifier_field = Member::get_unique_identifier_field();
|
||||||
|
|
||||||
|
Member::set_unique_identifier_field('Email');
|
||||||
|
|
||||||
|
parent::setUp();
|
||||||
|
}
|
||||||
|
|
||||||
|
function tearDown() {
|
||||||
|
parent::tearDown();
|
||||||
|
|
||||||
|
// set old member::get_unique_identifier_field value
|
||||||
|
if ($this->member_unique_identifier_field) {
|
||||||
|
Member::set_unique_identifier_field($this->member_unique_identifier_field);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function testSpecialCharacters() {
|
function testSpecialCharacters() {
|
||||||
$service = new RestfulServiceTest_MockRestfulService(Director::absoluteBaseURL());
|
$service = new RestfulServiceTest_MockRestfulService(Director::absoluteBaseURL());
|
||||||
$url = 'RestfulServiceTest_Controller/';
|
$url = 'RestfulServiceTest_Controller/';
|
||||||
@ -134,8 +158,16 @@ class RestfulServiceTest extends SapphireTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class RestfulServiceTest_Controller extends Controller implements TestOnly {
|
class RestfulServiceTest_Controller extends Controller implements TestOnly {
|
||||||
|
|
||||||
|
public static $allowed_actions = array(
|
||||||
|
'index',
|
||||||
|
'httpErrorWithoutCache',
|
||||||
|
'httpErrorWithCache'
|
||||||
|
);
|
||||||
|
|
||||||
public function init() {
|
public function init() {
|
||||||
$this->basicAuthEnabled = false;
|
$this->basicAuthEnabled = false;
|
||||||
|
|
||||||
parent::init();
|
parent::init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user