mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Compare commits
2 Commits
7ee6edf4b1
...
598356a0a4
Author | SHA1 | Date | |
---|---|---|---|
|
598356a0a4 | ||
|
790faa6260 |
@ -391,7 +391,7 @@ class Deprecation
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Getting a backtrace is slow, so we only do it if we need it
|
// Getting a backtrace is slow, so we only do it if we need it
|
||||||
$backtrace = null;
|
$backtrace = [];
|
||||||
|
|
||||||
// Get the calling scope
|
// Get the calling scope
|
||||||
if ($scope == Deprecation::SCOPE_METHOD) {
|
if ($scope == Deprecation::SCOPE_METHOD) {
|
||||||
|
@ -111,8 +111,8 @@ class DeprecationTest extends SapphireTest
|
|||||||
'Will be removed without equivalent functionality to replace it.',
|
'Will be removed without equivalent functionality to replace it.',
|
||||||
'Called from SilverStripe\Dev\Tests\DeprecationTest->testNoticeNoReplacement.'
|
'Called from SilverStripe\Dev\Tests\DeprecationTest->testNoticeNoReplacement.'
|
||||||
]);
|
]);
|
||||||
$this->expectDeprecation();
|
$this->expectException(DeprecationTestException::class);
|
||||||
$this->expectDeprecationMessage($message);
|
$this->expectExceptionMessage($message);
|
||||||
$this->enableDeprecationNotices(true);
|
$this->enableDeprecationNotices(true);
|
||||||
$ret = $this->myDeprecatedMethodNoReplacement();
|
$ret = $this->myDeprecatedMethodNoReplacement();
|
||||||
$this->assertSame('abc', $ret);
|
$this->assertSame('abc', $ret);
|
||||||
|
@ -138,16 +138,36 @@ class SearchContextTest extends SapphireTest
|
|||||||
public function testUserDefinedFieldsAppearInSearchContext()
|
public function testUserDefinedFieldsAppearInSearchContext()
|
||||||
{
|
{
|
||||||
$company = SearchContextTest\Company::singleton();
|
$company = SearchContextTest\Company::singleton();
|
||||||
$context = $company->getDefaultSearchContext();
|
$searchName = $company->getGeneralSearchFieldName();
|
||||||
$this->assertEquals(
|
$expected = new FieldList(
|
||||||
new FieldList(
|
new HiddenField($searchName, 'General Search'),
|
||||||
new HiddenField($company->getGeneralSearchFieldName(), 'General Search'),
|
|
||||||
(new TextField("Name", 'Name'))
|
(new TextField("Name", 'Name'))
|
||||||
->setMaxLength(255),
|
->setMaxLength(255),
|
||||||
new TextareaField("Industry", 'Industry'),
|
new TextareaField("Industry", 'Industry'),
|
||||||
new NumericField("AnnualProfit", 'The Almighty Annual Profit')
|
new NumericField("AnnualProfit", 'The Almighty Annual Profit')
|
||||||
),
|
);
|
||||||
$context->getFields()
|
$context = $company->getDefaultSearchContext();
|
||||||
|
$actual = $context->getFields();
|
||||||
|
$this->assertSame($expected->count(), $actual->count());
|
||||||
|
$this->assertEquals(
|
||||||
|
$expected->fieldByName($searchName)->Title,
|
||||||
|
$actual->fieldByName($searchName)->Title
|
||||||
|
);
|
||||||
|
$this->assertEquals(
|
||||||
|
$expected->fieldByName('Name')->Title,
|
||||||
|
$actual->fieldByName('Name')->Title
|
||||||
|
);
|
||||||
|
$this->assertEquals(
|
||||||
|
$expected->fieldByName('Name')->getMaxLength(),
|
||||||
|
$actual->fieldByName('Name')->getMaxLength()
|
||||||
|
);
|
||||||
|
$this->assertEquals(
|
||||||
|
$expected->fieldByName('Industry')->Title,
|
||||||
|
$actual->fieldByName('Industry')->Title
|
||||||
|
);
|
||||||
|
$this->assertEquals(
|
||||||
|
$expected->fieldByName('AnnualProfit')->Title,
|
||||||
|
$actual->fieldByName('AnnualProfit')->Title
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user