mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge remote-tracking branch 'origin/3.1'
This commit is contained in:
commit
ef03dfdd5b
@ -391,14 +391,15 @@ class SS_ClassManifest {
|
||||
$extends = substr($extends, 1);
|
||||
}
|
||||
|
||||
if (array_key_exists($name, $this->classes)) {
|
||||
$lowercaseName = strtolower($name);
|
||||
if (array_key_exists($lowercaseName, $this->classes)) {
|
||||
throw new Exception(sprintf(
|
||||
'There are two files containing the "%s" class: "%s" and "%s"',
|
||||
$name, $this->classes[$name], $pathname
|
||||
$name, $this->classes[$lowercaseName], $pathname
|
||||
));
|
||||
}
|
||||
|
||||
$this->classes[strtolower($name)] = $pathname;
|
||||
$this->classes[$lowercaseName] = $pathname;
|
||||
|
||||
if ($extends) {
|
||||
$extends = strtolower($extends);
|
||||
|
@ -430,6 +430,7 @@ class FormField extends RequestHandler {
|
||||
'class' => $this->extraClass(),
|
||||
'id' => $this->ID(),
|
||||
'disabled' => $this->isDisabled(),
|
||||
'readonly' => $this->isReadonly()
|
||||
);
|
||||
|
||||
if ($this->Required()) {
|
||||
|
@ -106,49 +106,6 @@ class CmsUiContext extends BehatContext {
|
||||
return $cms_tree_element;
|
||||
}
|
||||
|
||||
protected function getGridfieldTable($title) {
|
||||
$page = $this->getSession()->getPage();
|
||||
$table_elements = $page->findAll('css', '.ss-gridfield-table');
|
||||
assertNotNull($table_elements, 'Table elements not found');
|
||||
|
||||
$table_element = null;
|
||||
foreach ($table_elements as $table) {
|
||||
$table_title_element = $table->find('css', '.title');
|
||||
if ($table_title_element && $table_title_element->getText() === $title) {
|
||||
$table_element = $table;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Some {@link GridField} tables don't have a visible title, so look for a fieldset with data-name instead
|
||||
if(!$table_element) {
|
||||
$fieldset = $page->findAll('xpath', "//fieldset[@data-name='$title']");
|
||||
if(is_array($fieldset) && isset($fieldset[0])) {
|
||||
$table_element = $fieldset[0]->find('css', '.ss-gridfield-table');
|
||||
}
|
||||
}
|
||||
|
||||
assertNotNull($table_element, sprintf('Table `%s` not found', $title));
|
||||
|
||||
return $table_element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the first visible GridField table.
|
||||
*/
|
||||
protected function getFirstGridFieldTable() {
|
||||
$page = $this->getSession()->getPage();
|
||||
$tableElements = $page->findAll('css', '.ss-gridfield-table');
|
||||
assertNotNull($tableElements, 'Table elements not found');
|
||||
|
||||
// Return first found table.
|
||||
foreach($tableElements as $table) {
|
||||
if($table->isVisible()) return $table;
|
||||
}
|
||||
|
||||
assertNotNull(null, 'First visible table element not found');
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^I should see a "([^"]*)" button in CMS Content Toolbar$/
|
||||
*/
|
||||
@ -279,51 +236,6 @@ class CmsUiContext extends BehatContext {
|
||||
$tab_element->click();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the "([^"]*)" table should contain "([^"]*)"$/
|
||||
*/
|
||||
public function theTableShouldContain($table, $text) {
|
||||
$table_element = $this->getGridfieldTable($table);
|
||||
|
||||
$element = $table_element->find('named', array('content', "'$text'"));
|
||||
assertNotNull($element, sprintf('Element containing `%s` not found in `%s` table', $text, $table));
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the "([^"]*)" table should not contain "([^"]*)"$/
|
||||
*/
|
||||
public function theTableShouldNotContain($table, $text) {
|
||||
$table_element = $this->getGridfieldTable($table);
|
||||
|
||||
$element = $table_element->find('named', array('content', "'$text'"));
|
||||
assertNull($element, sprintf('Element containing `%s` not found in `%s` table', $text, $table));
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^I click on "([^"]*)" in the "([^"]*)" table$/
|
||||
*/
|
||||
public function iClickOnInTheTable($text, $table) {
|
||||
$table_element = $this->getGridfieldTable($table);
|
||||
|
||||
$element = $table_element->find('xpath', sprintf('//*[count(*)=0 and contains(.,"%s")]', $text));
|
||||
assertNotNull($element, sprintf('Element containing `%s` not found', $text));
|
||||
$element->click();
|
||||
}
|
||||
|
||||
/**
|
||||
* Clicks on a row in the first found visible GridField table.
|
||||
* Example: I click on "New Zealand" in the table
|
||||
*
|
||||
* @Given /^I click on "([^"]*)" in the table$/
|
||||
*/
|
||||
public function iClickOnInTheFirstTable($text) {
|
||||
$table_element = $this->getFirstGridFieldTable();
|
||||
|
||||
$element = $table_element->find('xpath', sprintf('//*[count(*)=0 and contains(.,"%s")]', $text));
|
||||
assertNotNull($element, sprintf('Element containing `%s` not found', $text));
|
||||
$element->click();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^I can see the preview panel$/
|
||||
*/
|
||||
|
@ -11,7 +11,7 @@ Feature: Manage Security Permissions for Groups
|
||||
And I am logged in with "ADMIN" permissions
|
||||
And I go to "/admin/security"
|
||||
And I click the "Groups" CMS tab
|
||||
And I click on "test group" in the table
|
||||
And I click on "test group" in the "Groups" table
|
||||
And I click the "Permissions" CMS tab
|
||||
|
||||
Scenario: I can see sub-permissions being properly set and restored when using "Access to all CMS sections"
|
||||
|
@ -126,4 +126,14 @@ class ClassManifestTest extends SapphireTest {
|
||||
public function testManifestExcludeFilesPrefixedWithUnderscore() {
|
||||
$this->assertNotContains('ignore', array_keys($this->manifest->getClasses()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert that ClassManifest throws an exception when it encounters two files
|
||||
* which contain classes with the same name
|
||||
* @expectedException Exception
|
||||
*/
|
||||
public function testManifestWarnsAboutDuplicateClasses() {
|
||||
$dummy = new SS_ClassManifest(dirname(__FILE__) . '/fixtures/classmanifest_duplicates', false, true, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
class TESTClass { }
|
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
class testCLASS { }
|
@ -104,6 +104,22 @@ class FormFieldTest extends SapphireTest {
|
||||
$this->assertContains('three="3"', $field->getAttributesHTML('one', 'two'));
|
||||
}
|
||||
|
||||
public function testReadonly() {
|
||||
$field = new FormField('MyField');
|
||||
$field->setReadonly(true);
|
||||
$this->assertContains('readonly="readonly"', $field->getAttributesHTML());
|
||||
$field->setReadonly(false);
|
||||
$this->assertNotContains('readonly="readonly"', $field->getAttributesHTML());
|
||||
}
|
||||
|
||||
public function testDisabled() {
|
||||
$field = new FormField('MyField');
|
||||
$field->setDisabled(true);
|
||||
$this->assertContains('disabled="disabled"', $field->getAttributesHTML());
|
||||
$field->setDisabled(false);
|
||||
$this->assertNotContains('disabled="disabled"', $field->getAttributesHTML());
|
||||
}
|
||||
|
||||
public function testEveryFieldTransformsReadonlyAsClone() {
|
||||
$fieldClasses = ClassInfo::subclassesFor('FormField');
|
||||
foreach($fieldClasses as $fieldClass) {
|
||||
|
Loading…
Reference in New Issue
Block a user