mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Merge remote-tracking branch 'origin/3.0' into 3.1
Conflicts: admin/javascript/LeftAndMain.js tests/behat/features/bootstrap/SilverStripe/Framework/Test/Behaviour/CmsUiContext.php tests/control/ControllerTest.php
This commit is contained in:
commit
2160fb8000
@ -5,10 +5,23 @@ jQuery.noConflict();
|
|||||||
*/
|
*/
|
||||||
(function($) {
|
(function($) {
|
||||||
|
|
||||||
window.onresize = function(e) {
|
var windowWidth, windowHeight;
|
||||||
|
$(window).bind('resize.leftandmain', function(e) {
|
||||||
// Entwine's 'fromWindow::onresize' does not trigger on IE8. Use synthetic event.
|
// Entwine's 'fromWindow::onresize' does not trigger on IE8. Use synthetic event.
|
||||||
$('.cms-container').trigger('windowresize');
|
var cb = function() {$('.cms-container').trigger('windowresize');};
|
||||||
};
|
|
||||||
|
// Workaround to avoid IE8 infinite loops when elements are resized as a result of this event
|
||||||
|
if($.browser.msie && parseInt($.browser.version, 10) < 9) {
|
||||||
|
var newWindowWidth = $(window).width(), newWindowHeight = $(window).height();
|
||||||
|
if(newWindowWidth != windowWidth || newWindowHeight != windowHeight) {
|
||||||
|
windowWidth = newWindowWidth;
|
||||||
|
windowHeight = newWindowHeight;
|
||||||
|
cb();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
cb();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// setup jquery.entwine
|
// setup jquery.entwine
|
||||||
$.entwine.warningLevel = $.entwine.WARN_LEVEL_BESTPRACTISE;
|
$.entwine.warningLevel = $.entwine.WARN_LEVEL_BESTPRACTISE;
|
||||||
@ -136,7 +149,7 @@ jQuery.noConflict();
|
|||||||
this._super();
|
this._super();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize layouts
|
// Initialize layouts
|
||||||
this.redraw();
|
this.redraw();
|
||||||
|
|
||||||
@ -228,15 +241,15 @@ jQuery.noConflict();
|
|||||||
},
|
},
|
||||||
this.getLayoutOptions()
|
this.getLayoutOptions()
|
||||||
));
|
));
|
||||||
|
|
||||||
// Trigger layout algorithm once at the top. This also lays out children - we move from outside to
|
// Trigger layout algorithm once at the top. This also lays out children - we move from outside to
|
||||||
// inside, resizing to fit the parent.
|
// inside, resizing to fit the parent.
|
||||||
this.layout();
|
this.layout();
|
||||||
|
|
||||||
// Redraw on all the children that need it
|
// Redraw on all the children that need it
|
||||||
this.find('.cms-panel-layout').redraw();
|
this.find('.cms-panel-layout').redraw();
|
||||||
this.find('.cms-content-fields[data-layout-type]').redraw();
|
this.find('.cms-content-fields[data-layout-type]').redraw();
|
||||||
this.find('.cms-edit-form[data-layout-type]').redraw();
|
this.find('.cms-edit-form[data-layout-type]').redraw();
|
||||||
this.find('.cms-preview').redraw();
|
this.find('.cms-preview').redraw();
|
||||||
this.find('.cms-content').redraw();
|
this.find('.cms-content').redraw();
|
||||||
},
|
},
|
||||||
@ -590,7 +603,7 @@ jQuery.noConflict();
|
|||||||
if(typeof(window.sessionStorage)=="undefined" || window.sessionStorage === null) return;
|
if(typeof(window.sessionStorage)=="undefined" || window.sessionStorage === null) return;
|
||||||
|
|
||||||
var selectedTabs = [], url = this._tabStateUrl();
|
var selectedTabs = [], url = this._tabStateUrl();
|
||||||
this.find('.cms-tabset,.ss-tabset').each(function(i, el) {
|
this.find('.cms-tabset,.ss-tabset').each(function(i, el) {
|
||||||
var id = $(el).attr('id');
|
var id = $(el).attr('id');
|
||||||
if(!id) return; // we need a unique reference
|
if(!id) return; // we need a unique reference
|
||||||
if(!$(el).data('tabs')) return; // don't act on uninit'ed controls
|
if(!$(el).data('tabs')) return; // don't act on uninit'ed controls
|
||||||
@ -650,8 +663,8 @@ jQuery.noConflict();
|
|||||||
} else if(sessionStates) {
|
} else if(sessionStates) {
|
||||||
$.each(sessionStates, function(i, sessionState) {
|
$.each(sessionStates, function(i, sessionState) {
|
||||||
if(tabset.is('#' + sessionState.id)) index = sessionState.selected;
|
if(tabset.is('#' + sessionState.id)) index = sessionState.selected;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if(index !== null) tabset.tabs('select', index);
|
if(index !== null) tabset.tabs('select', index);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -671,7 +684,7 @@ jQuery.noConflict();
|
|||||||
} else {
|
} else {
|
||||||
for(var i=0;i<s.length;i++) {
|
for(var i=0;i<s.length;i++) {
|
||||||
if(s.key(i).match(/^tabs-/)) s.removeItem(s.key(i));
|
if(s.key(i).match(/^tabs-/)) s.removeItem(s.key(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -818,18 +831,18 @@ jQuery.noConflict();
|
|||||||
$('.cms-content .Actions').entwine({
|
$('.cms-content .Actions').entwine({
|
||||||
onmatch: function() {
|
onmatch: function() {
|
||||||
this.find('.ss-ui-button').click(function() {
|
this.find('.ss-ui-button').click(function() {
|
||||||
var form = this.form;
|
var form = this.form;
|
||||||
|
|
||||||
// forms don't natively store the button they've been triggered with
|
// forms don't natively store the button they've been triggered with
|
||||||
if(form) {
|
if(form) {
|
||||||
form.clickedButton = this;
|
form.clickedButton = this;
|
||||||
// Reset the clicked button shortly after the onsubmit handlers
|
// Reset the clicked button shortly after the onsubmit handlers
|
||||||
// have fired on the form
|
// have fired on the form
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
form.clickedButton = null;
|
form.clickedButton = null;
|
||||||
}, 10);
|
}, 10);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.redraw();
|
this.redraw();
|
||||||
this._super();
|
this._super();
|
||||||
@ -974,13 +987,13 @@ jQuery.noConflict();
|
|||||||
$(".cms-search-form button[type=reset], .cms-search-form input[type=reset]").entwine({
|
$(".cms-search-form button[type=reset], .cms-search-form input[type=reset]").entwine({
|
||||||
onclick: function(e) {
|
onclick: function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
var form = $(this).parents('form');
|
var form = $(this).parents('form');
|
||||||
|
|
||||||
form.clearForm();
|
form.clearForm();
|
||||||
form.find(".dropdown select").prop('selectedIndex', 0).trigger("liszt:updated"); // Reset chosen.js
|
form.find(".dropdown select").prop('selectedIndex', 0).trigger("liszt:updated"); // Reset chosen.js
|
||||||
form.submit();
|
form.submit();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1051,7 +1064,7 @@ jQuery.noConflict();
|
|||||||
},
|
},
|
||||||
redrawTabs: function() {
|
redrawTabs: function() {
|
||||||
this.rewriteHashlinks();
|
this.rewriteHashlinks();
|
||||||
|
|
||||||
var id = this.attr('id'), activeTab = this.find('ul:first .ui-tabs-active');
|
var id = this.attr('id'), activeTab = this.find('ul:first .ui-tabs-active');
|
||||||
|
|
||||||
if(!this.data('uiTabs')) this.tabs({
|
if(!this.data('uiTabs')) this.tabs({
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
* - SS_DATABASE_SUFFIX: A suffix to add to the database name.
|
* - SS_DATABASE_SUFFIX: A suffix to add to the database name.
|
||||||
* - SS_DATABASE_PREFIX: A prefix to add to the database name.
|
* - SS_DATABASE_PREFIX: A prefix to add to the database name.
|
||||||
* - SS_DATABASE_TIMEZONE: Set the database timezone to something other than the system timezone.
|
* - SS_DATABASE_TIMEZONE: Set the database timezone to something other than the system timezone.
|
||||||
|
* - SS_DATABASE_MEMORY: Use in-memory state if possible. Useful for testing, currently only
|
||||||
|
* supported by the SQLite database adapter.
|
||||||
*
|
*
|
||||||
* There is one more setting that is intended to be used by people who work on SilverStripe.
|
* There is one more setting that is intended to be used by people who work on SilverStripe.
|
||||||
* - SS_DATABASE_CHOOSE_NAME: Boolean/Int. If set, then the system will choose a default database name for you if
|
* - SS_DATABASE_CHOOSE_NAME: Boolean/Int. If set, then the system will choose a default database name for you if
|
||||||
@ -110,6 +112,10 @@ if(defined('SS_DATABASE_USERNAME') && defined('SS_DATABASE_PASSWORD')) {
|
|||||||
// For schema enabled drivers:
|
// For schema enabled drivers:
|
||||||
if(defined('SS_DATABASE_SCHEMA'))
|
if(defined('SS_DATABASE_SCHEMA'))
|
||||||
$databaseConfig["schema"] = SS_DATABASE_SCHEMA;
|
$databaseConfig["schema"] = SS_DATABASE_SCHEMA;
|
||||||
|
|
||||||
|
// For SQlite3 memory databases (mainly for testing purposes)
|
||||||
|
if(defined('SS_DATABASE_MEMORY'))
|
||||||
|
$databaseConfig["memory"] = SS_DATABASE_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(defined('SS_SEND_ALL_EMAILS_TO')) {
|
if(defined('SS_SEND_ALL_EMAILS_TO')) {
|
||||||
|
@ -173,7 +173,7 @@ the markup in the `else` clause is used, if that clause is present.
|
|||||||
:::ss
|
:::ss
|
||||||
<% if $MyDinner=="quiche" %>
|
<% if $MyDinner=="quiche" %>
|
||||||
Real men don't eat quiche
|
Real men don't eat quiche
|
||||||
<% else_if $MyDinner=$YourDinner %>
|
<% else_if $MyDinner==$YourDinner %>
|
||||||
We both have good taste
|
We both have good taste
|
||||||
<% else %>
|
<% else %>
|
||||||
Can I have some of your chips?
|
Can I have some of your chips?
|
||||||
|
@ -56,16 +56,16 @@ The `phpunit` binary should be used from the root directory of your website.
|
|||||||
|
|
||||||
# Runs all tests defined in phpunit.xml
|
# Runs all tests defined in phpunit.xml
|
||||||
phpunit
|
phpunit
|
||||||
|
|
||||||
# Run all tests of a specific module
|
# Run all tests of a specific module
|
||||||
phpunit framework/tests/
|
phpunit framework/tests/
|
||||||
|
|
||||||
# Run specific tests within a specific module
|
# Run specific tests within a specific module
|
||||||
phpunit framework/tests/filesystem
|
phpunit framework/tests/filesystem
|
||||||
|
|
||||||
# Run a specific test
|
# Run a specific test
|
||||||
phpunit framework/tests/filesystem/FolderTest.php
|
phpunit framework/tests/filesystem/FolderTest.php
|
||||||
|
|
||||||
# Run tests with optional `$_GET` parameters (you need an empty second argument)
|
# Run tests with optional `$_GET` parameters (you need an empty second argument)
|
||||||
phpunit framework/tests '' flush=all
|
phpunit framework/tests '' flush=all
|
||||||
|
|
||||||
@ -81,16 +81,16 @@ particularly around formatting test output.
|
|||||||
|
|
||||||
# Run all tests
|
# Run all tests
|
||||||
sake dev/tests/all
|
sake dev/tests/all
|
||||||
|
|
||||||
# Run all tests of a specific module (comma-separated)
|
# Run all tests of a specific module (comma-separated)
|
||||||
sake dev/tests/module/framework,cms
|
sake dev/tests/module/framework,cms
|
||||||
|
|
||||||
# Run specific tests (comma-separated)
|
# Run specific tests (comma-separated)
|
||||||
sake dev/tests/FolderTest,OtherTest
|
sake dev/tests/FolderTest,OtherTest
|
||||||
|
|
||||||
# Run tests with optional `$_GET` parameters
|
# Run tests with optional `$_GET` parameters
|
||||||
sake dev/tests/all flush=all
|
sake dev/tests/all flush=all
|
||||||
|
|
||||||
# Skip some tests
|
# Skip some tests
|
||||||
sake dev/tests/all SkipTests=MySkippedTest
|
sake dev/tests/all SkipTests=MySkippedTest
|
||||||
|
|
||||||
@ -187,4 +187,4 @@ understand the problem space and discover suitable APIs for performing specific
|
|||||||
**Behavior Driven Development (BDD):** An extension of the test-driven programming style, where tests are used primarily
|
**Behavior Driven Development (BDD):** An extension of the test-driven programming style, where tests are used primarily
|
||||||
for describing the specification of how code should perform. In practice, there's little or no technical difference - it
|
for describing the specification of how code should perform. In practice, there's little or no technical difference - it
|
||||||
all comes down to language. In BDD, the usual terminology is changed to reflect this change of focus, so *Specification*
|
all comes down to language. In BDD, the usual terminology is changed to reflect this change of focus, so *Specification*
|
||||||
is used in place of *Test Case*, and *should* is used in place of *expect* and *assert*.
|
is used in place of *Test Case*, and *should* is used in place of *expect* and *assert*.
|
||||||
|
@ -4,8 +4,22 @@
|
|||||||
* On resize of any close the open treedropdownfields
|
* On resize of any close the open treedropdownfields
|
||||||
* as we'll need to redo with widths
|
* as we'll need to redo with widths
|
||||||
*/
|
*/
|
||||||
$(window).resize(function() {
|
var windowWidth, windowHeight;
|
||||||
$('.TreeDropdownField').closePanel();
|
$(window).bind('resize.treedropdownfield', function() {
|
||||||
|
// Entwine's 'fromWindow::onresize' does not trigger on IE8. Use synthetic event.
|
||||||
|
var cb = function() {$('.TreeDropdownField').closePanel();};
|
||||||
|
|
||||||
|
// Workaround to avoid IE8 infinite loops when elements are resized as a result of this event
|
||||||
|
if($.browser.msie && parseInt($.browser.version, 10) < 9) {
|
||||||
|
var newWindowWidth = $(window).width(), newWindowHeight = $(window).height();
|
||||||
|
if(newWindowWidth != windowWidth || newWindowHeight != windowHeight) {
|
||||||
|
windowWidth = newWindowWidth;
|
||||||
|
windowHeight = newWindowHeight;
|
||||||
|
cb();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
cb();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var strings = {
|
var strings = {
|
||||||
|
@ -363,13 +363,13 @@ class CmsUiContext extends BehatContext
|
|||||||
}
|
}
|
||||||
|
|
||||||
assertNotNull($container, 'Chosen.js field container not found');
|
assertNotNull($container, 'Chosen.js field container not found');
|
||||||
|
|
||||||
// Click on newly expanded list element, indirectly setting the dropdown value
|
// Click on newly expanded list element, indirectly setting the dropdown value
|
||||||
$linkEl = $container->find('xpath', './/a[./@href]');
|
$linkEl = $container->find('xpath', './/a[./@href]');
|
||||||
assertNotNull($linkEl, 'Chosen.js link element not found');
|
assertNotNull($linkEl, 'Chosen.js link element not found');
|
||||||
$this->getSession()->wait(100); // wait for dropdown overlay to appear
|
$this->getSession()->wait(100); // wait for dropdown overlay to appear
|
||||||
$linkEl->click();
|
$linkEl->click();
|
||||||
|
|
||||||
if(in_array('treedropdown', explode(' ', $container->getAttribute('class')))) {
|
if(in_array('treedropdown', explode(' ', $container->getAttribute('class')))) {
|
||||||
// wait for ajax dropdown to load
|
// wait for ajax dropdown to load
|
||||||
$this->getSession()->wait(
|
$this->getSession()->wait(
|
||||||
@ -422,7 +422,7 @@ class CmsUiContext extends BehatContext
|
|||||||
) {
|
) {
|
||||||
if($container->isVisible() && in_array($class, explode(' ', $container->getAttribute('class')))) {
|
if($container->isVisible() && in_array($class, explode(' ', $container->getAttribute('class')))) {
|
||||||
return $container;
|
return $container;
|
||||||
}
|
}
|
||||||
$container = $container->getParent();
|
$container = $container->getParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ class ControllerTest extends FunctionalTest {
|
|||||||
protected static $fixture_file = 'ControllerTest.yml';
|
protected static $fixture_file = 'ControllerTest.yml';
|
||||||
|
|
||||||
protected $autoFollowRedirection = false;
|
protected $autoFollowRedirection = false;
|
||||||
|
|
||||||
protected $requiredExtensions = array(
|
protected $requiredExtensions = array(
|
||||||
'ControllerTest_AccessBaseController' => array(
|
'ControllerTest_AccessBaseController' => array(
|
||||||
'ControllerTest_AccessBaseControllerExtension'
|
'ControllerTest_AccessBaseControllerExtension'
|
||||||
@ -44,7 +44,7 @@ class ControllerTest extends FunctionalTest {
|
|||||||
|
|
||||||
public function testAllowedActions() {
|
public function testAllowedActions() {
|
||||||
$adminUser = $this->objFromFixture('Member', 'admin');
|
$adminUser = $this->objFromFixture('Member', 'admin');
|
||||||
|
|
||||||
$response = $this->get("ControllerTest_UnsecuredController/");
|
$response = $this->get("ControllerTest_UnsecuredController/");
|
||||||
$this->assertEquals(200, $response->getStatusCode(),
|
$this->assertEquals(200, $response->getStatusCode(),
|
||||||
'Access granted on index action without $allowed_actions on defining controller, ' .
|
'Access granted on index action without $allowed_actions on defining controller, ' .
|
||||||
@ -62,7 +62,7 @@ class ControllerTest extends FunctionalTest {
|
|||||||
'Access granted on action without $allowed_actions on defining controller, ' .
|
'Access granted on action without $allowed_actions on defining controller, ' .
|
||||||
'when called without an action in the URL'
|
'when called without an action in the URL'
|
||||||
);
|
);
|
||||||
|
|
||||||
$response = $this->get("ControllerTest_AccessBaseController/");
|
$response = $this->get("ControllerTest_AccessBaseController/");
|
||||||
$this->assertEquals(200, $response->getStatusCode(),
|
$this->assertEquals(200, $response->getStatusCode(),
|
||||||
'Access granted on index with empty $allowed_actions on defining controller, ' .
|
'Access granted on index with empty $allowed_actions on defining controller, ' .
|
||||||
@ -110,6 +110,12 @@ class ControllerTest extends FunctionalTest {
|
|||||||
'if action is not a method but rather a template discovered by naming convention'
|
'if action is not a method but rather a template discovered by naming convention'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$response = $this->get("ControllerTest_AccessSecuredController/templateaction");
|
||||||
|
$this->assertEquals(403, $response->getStatusCode(),
|
||||||
|
'Access denied on action with $allowed_actions on defining controller, ' .
|
||||||
|
'if action is not a method but rather a template discovered by naming convention'
|
||||||
|
);
|
||||||
|
|
||||||
$this->session()->inst_set('loggedInAs', $adminUser->ID);
|
$this->session()->inst_set('loggedInAs', $adminUser->ID);
|
||||||
$response = $this->get("ControllerTest_AccessSecuredController/templateaction");
|
$response = $this->get("ControllerTest_AccessSecuredController/templateaction");
|
||||||
$this->assertEquals(200, $response->getStatusCode(),
|
$this->assertEquals(200, $response->getStatusCode(),
|
||||||
@ -147,25 +153,25 @@ class ControllerTest extends FunctionalTest {
|
|||||||
"Access granted to method defined in allowed_actions on extension, " .
|
"Access granted to method defined in allowed_actions on extension, " .
|
||||||
"where method is also defined on extension"
|
"where method is also defined on extension"
|
||||||
);
|
);
|
||||||
|
|
||||||
$response = $this->get('ControllerTest_AccessSecuredController/extensionmethod1');
|
$response = $this->get('ControllerTest_AccessSecuredController/extensionmethod1');
|
||||||
$this->assertEquals(200, $response->getStatusCode(),
|
$this->assertEquals(200, $response->getStatusCode(),
|
||||||
"Access granted to method defined in allowed_actions on extension, " .
|
"Access granted to method defined in allowed_actions on extension, " .
|
||||||
"where method is also defined on extension, even when called in a subclass"
|
"where method is also defined on extension, even when called in a subclass"
|
||||||
);
|
);
|
||||||
|
|
||||||
$response = $this->get('ControllerTest_AccessBaseController/extensionmethod2');
|
$response = $this->get('ControllerTest_AccessBaseController/extensionmethod2');
|
||||||
$this->assertEquals(404, $response->getStatusCode(),
|
$this->assertEquals(404, $response->getStatusCode(),
|
||||||
"Access denied to method not defined in allowed_actions on extension, " .
|
"Access denied to method not defined in allowed_actions on extension, " .
|
||||||
"where method is also defined on extension"
|
"where method is also defined on extension"
|
||||||
);
|
);
|
||||||
|
|
||||||
$response = $this->get('ControllerTest_IndexSecuredController/');
|
$response = $this->get('ControllerTest_IndexSecuredController/');
|
||||||
$this->assertEquals(403, $response->getStatusCode(),
|
$this->assertEquals(403, $response->getStatusCode(),
|
||||||
"Access denied when index action is limited through allowed_actions, " .
|
"Access denied when index action is limited through allowed_actions, " .
|
||||||
"and doesn't satisfy checks, and action is empty"
|
"and doesn't satisfy checks, and action is empty"
|
||||||
);
|
);
|
||||||
|
|
||||||
$response = $this->get('ControllerTest_IndexSecuredController/index');
|
$response = $this->get('ControllerTest_IndexSecuredController/index');
|
||||||
$this->assertEquals(403, $response->getStatusCode(),
|
$this->assertEquals(403, $response->getStatusCode(),
|
||||||
"Access denied when index action is limited through allowed_actions, " .
|
"Access denied when index action is limited through allowed_actions, " .
|
||||||
@ -174,13 +180,13 @@ class ControllerTest extends FunctionalTest {
|
|||||||
|
|
||||||
$this->session()->inst_set('loggedInAs', $adminUser->ID);
|
$this->session()->inst_set('loggedInAs', $adminUser->ID);
|
||||||
$response = $this->get('ControllerTest_IndexSecuredController/');
|
$response = $this->get('ControllerTest_IndexSecuredController/');
|
||||||
$this->assertEquals(200, $response->getStatusCode(),
|
$this->assertEquals(200, $response->getStatusCode(),
|
||||||
"Access granted when index action is limited through allowed_actions, " .
|
"Access granted when index action is limited through allowed_actions, " .
|
||||||
"and does satisfy checks"
|
"and does satisfy checks"
|
||||||
);
|
);
|
||||||
$this->session()->inst_set('loggedInAs', null);
|
$this->session()->inst_set('loggedInAs', null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException PHPUnit_Framework_Error
|
* @expectedException PHPUnit_Framework_Error
|
||||||
* @expectedExceptionMessage Wildcards (*) are no longer valid
|
* @expectedExceptionMessage Wildcards (*) are no longer valid
|
||||||
@ -358,7 +364,7 @@ class ControllerTest extends FunctionalTest {
|
|||||||
class ControllerTest_Controller extends Controller implements TestOnly {
|
class ControllerTest_Controller extends Controller implements TestOnly {
|
||||||
|
|
||||||
public $Content = "default content";
|
public $Content = "default content";
|
||||||
|
|
||||||
private static $allowed_actions = array(
|
private static $allowed_actions = array(
|
||||||
'methodaction',
|
'methodaction',
|
||||||
'stringaction',
|
'stringaction',
|
||||||
@ -385,13 +391,13 @@ class ControllerTest_UnsecuredController extends Controller implements TestOnly
|
|||||||
|
|
||||||
// Not defined, allow access to all
|
// Not defined, allow access to all
|
||||||
// static $allowed_actions = array();
|
// static $allowed_actions = array();
|
||||||
|
|
||||||
// Granted for all
|
// Granted for all
|
||||||
public function method1() {}
|
public function method1() {}
|
||||||
|
|
||||||
// Granted for all
|
// Granted for all
|
||||||
public function method2() {}
|
public function method2() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ControllerTest_AccessBaseController extends Controller implements TestOnly {
|
class ControllerTest_AccessBaseController extends Controller implements TestOnly {
|
||||||
|
|
||||||
@ -402,7 +408,7 @@ class ControllerTest_AccessBaseController extends Controller implements TestOnly
|
|||||||
|
|
||||||
// Denied for all
|
// Denied for all
|
||||||
public function method2() {}
|
public function method2() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ControllerTest_AccessSecuredController extends ControllerTest_AccessBaseController implements TestOnly {
|
class ControllerTest_AccessSecuredController extends ControllerTest_AccessBaseController implements TestOnly {
|
||||||
|
|
||||||
@ -414,7 +420,7 @@ class ControllerTest_AccessSecuredController extends ControllerTest_AccessBaseCo
|
|||||||
);
|
);
|
||||||
|
|
||||||
public function method2() {}
|
public function method2() {}
|
||||||
|
|
||||||
public function adminonly() {}
|
public function adminonly() {}
|
||||||
|
|
||||||
protected function protectedmethod() {}
|
protected function protectedmethod() {}
|
||||||
@ -427,18 +433,18 @@ class ControllerTest_AccessWildcardSecuredController extends ControllerTest_Acce
|
|||||||
"*" => "ADMIN", // should throw exception
|
"*" => "ADMIN", // should throw exception
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class ControllerTest_IndexSecuredController extends ControllerTest_AccessBaseController implements TestOnly {
|
class ControllerTest_IndexSecuredController extends ControllerTest_AccessBaseController implements TestOnly {
|
||||||
|
|
||||||
private static $allowed_actions = array(
|
private static $allowed_actions = array(
|
||||||
"index" => "ADMIN",
|
"index" => "ADMIN",
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class ControllerTest_AccessBaseControllerExtension extends Extension implements TestOnly {
|
class ControllerTest_AccessBaseControllerExtension extends Extension implements TestOnly {
|
||||||
|
|
||||||
private static $allowed_actions = array(
|
private static $allowed_actions = array(
|
||||||
"extensionmethod1" => true, // granted because defined on this class
|
"extensionmethod1" => true, // granted because defined on this class
|
||||||
"method1" => true, // ignored because method not defined on this class
|
"method1" => true, // ignored because method not defined on this class
|
||||||
@ -457,7 +463,7 @@ class ControllerTest_AccessBaseControllerExtension extends Extension implements
|
|||||||
|
|
||||||
public function internalextensionmethod() {}
|
public function internalextensionmethod() {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class ControllerTest_HasAction extends Controller {
|
class ControllerTest_HasAction extends Controller {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user