diff --git a/admin/code/ModelAdmin.php b/admin/code/ModelAdmin.php index b85cc6a61..a182cfdd7 100644 --- a/admin/code/ModelAdmin.php +++ b/admin/code/ModelAdmin.php @@ -457,7 +457,7 @@ abstract class ModelAdmin extends LeftAndMain { * overwrite the static page_length of the admin panel, * should be called in the project _config file. * - * @deprecated 3.1 Use "ModelAdmin.page_length" config setting + * @deprecated 3.2 Use "ModelAdmin.page_length" config setting */ public static function set_page_length($length){ Deprecation::notice('3.2', 'Use "ModelAdmin.page_length" config setting'); @@ -467,7 +467,7 @@ abstract class ModelAdmin extends LeftAndMain { /** * Return the static page_length of the admin, default as 30 * - * @deprecated 3.1 Use "ModelAdmin.page_length" config setting + * @deprecated 3.2 Use "ModelAdmin.page_length" config setting */ public static function get_page_length(){ Deprecation::notice('3.2', 'Use "ModelAdmin.page_length" config setting'); diff --git a/admin/code/SecurityAdmin.php b/admin/code/SecurityAdmin.php index 2e71de0bc..f30ca36a9 100755 --- a/admin/code/SecurityAdmin.php +++ b/admin/code/SecurityAdmin.php @@ -334,7 +334,7 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider { * The permissions represented in the $codes will not appearing in the form * containing {@link PermissionCheckboxSetField} so as not to be checked / unchecked. * - * @deprecated 3.1 Use "Permission.hidden_permissions" config setting instead + * @deprecated 3.2 Use "Permission.hidden_permissions" config setting instead * @param $codes String|Array */ public static function add_hidden_permission($codes){ @@ -344,7 +344,7 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider { } /** - * @deprecated 3.1 Use "Permission.hidden_permissions" config setting instead + * @deprecated 3.2 Use "Permission.hidden_permissions" config setting instead * @param $codes String|Array */ public static function remove_hidden_permission($codes){ @@ -354,7 +354,7 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider { } /** - * @deprecated 3.1 Use "Permission.hidden_permissions" config setting instead + * @deprecated 3.2 Use "Permission.hidden_permissions" config setting instead * @return Array */ public static function get_hidden_permissions(){ @@ -365,7 +365,7 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider { /** * Clear all permissions previously hidden with {@link add_hidden_permission} * - * @deprecated 3.1 Use "Permission.hidden_permissions" config setting instead + * @deprecated 3.2 Use "Permission.hidden_permissions" config setting instead */ public static function clear_hidden_permissions(){ Deprecation::notice('3.2', 'Use "Permission.hidden_permissions" config setting instead'); diff --git a/dev/FixtureFactory.php b/dev/FixtureFactory.php index 0c49ce533..28e6f3d95 100644 --- a/dev/FixtureFactory.php +++ b/dev/FixtureFactory.php @@ -224,4 +224,4 @@ class FixtureFactory { } } -} \ No newline at end of file +} diff --git a/dev/Profiler.php b/dev/Profiler.php deleted file mode 100644 index f0ef943be..000000000 --- a/dev/Profiler.php +++ /dev/null @@ -1,239 +0,0 @@ -description = array(); - $this->startTime = array(); - $this->endTime = array(); - $this->initTime = 0; - $this->cur_timer = ""; - $this->stack = array(); - $this->trail = ""; - $this->trace = ""; - $this->count = array(); - $this->running = array(); - $this->initTime = $this->getMicroTime(); - $this->output_enabled = $output_enabled; - $this->trace_enabled = $trace_enabled; - $this->startTimer('unprofiled'); - } - - // Public Methods - - public static function init() { - Deprecation::notice('3.1', 'The Profiler class is deprecated, use third party tools like XHProf instead'); - if(!self::$inst) self::$inst = new Profiler(true,true); - } - - public static function mark($name, $level2 = "", $desc = "") { - if($level2 && $_GET['debug_profile'] > 1) $name .= " $level2"; - - if(!self::$inst) self::$inst = new Profiler(true,true); - - self::$inst->startTimer($name, $desc); - } - public static function unmark($name, $level2 = "", $desc = "") { - if($level2 && $_GET['debug_profile'] > 1) $name .= " $level2"; - - if(!self::$inst) self::$inst = new Profiler(true,true); - - self::$inst->stopTimer($name, $desc); - } - public static function show($showTrace = false) { - if(!self::$inst) self::$inst = new Profiler(true,true); - - echo "
\n"); - $oaTime = $this->getMicroTime() - $this->initTime; - echo"============================================================================\n"; - echo " PROFILER OUTPUT\n"; - echo"============================================================================\n"; - print( "Calls Time Routine\n"); - echo"-----------------------------------------------------------------------------\n"; - while (list ($key, $val) = each ($this->description)) { - $t = $this->elapsedTime($key); - $total = $this->running[$key]; - $count = $this->count[$key]; - $TimedTotal += $total; - $perc = ($total/$oaTime)*100; - $tot_perc+=$perc; - // $perc=sprintf("%3.2f", $perc ); - $lines[ sprintf( "%3d %3.4f ms (%3.2f %%) %s\n", $count, $total*1000, $perc, $key) ] = $total; - } - arsort($lines); - foreach($lines as $line => $total) { - echo $line; - } - - echo "\n"; - - $missed=$oaTime-$TimedTotal; - $perc = ($missed/$oaTime)*100; - $tot_perc+=$perc; - // $perc=sprintf("%3.2f", $perc ); - printf( " %3.4f ms (%3.2f %%) %s\n", $missed*1000,$perc, "Missed"); - - echo"============================================================================\n"; - - printf( " %3.4f ms (%3.2f %%) %s\n", $oaTime*1000,$tot_perc, "OVERALL TIME"); - - echo"============================================================================\n"; - - print(""); - } - } - - public function printTrace( $enabled=false ) - { - if($this->trace_enabled||$enabled){ - print("
"); - print("Trace\n$this->trace\n\n"); - print(""); - } - } - - /// Internal Use Only Functions - - /** - * Get the current time as accuratly as possible - * - */ - public function getMicroTime(){ - $tmp=explode(' ', microtime()); - $rt=$tmp[0]+$tmp[1]; - return $rt; - } - - /** - * resume an individual timer - * - */ - public function __resumeTimer($name){ - $this->trace.="resume $name\n"; - $this->startTime[$name] = $this->getMicroTime(); - } - - /** - * suspend an individual timer - * - */ - public function __suspendTimer($name){ - $this->trace.="suspend $name\n"; - $this->endTime[$name] = $this->getMicroTime(); - if (!array_key_exists($name, $this->running)) - $this->running[$name] = $this->elapsedTime($name); - else - $this->running[$name] += $this->elapsedTime($name); - } -} diff --git a/dev/SapphireTest.php b/dev/SapphireTest.php index 114c578af..c659c4bf2 100644 --- a/dev/SapphireTest.php +++ b/dev/SapphireTest.php @@ -157,14 +157,8 @@ class SapphireTest extends PHPUnit_Framework_TestCase { return static::$fixture_file; } - /** - * @var array $fixtures Array of {@link YamlFixture} instances - * @deprecated 3.1 Use $fixtureFactory instad - */ - protected $fixtures = array(); - protected $model; - + public function setUp() { // We cannot run the tests on this abstract class. if(get_class($this) == "SapphireTest") $this->skipTest = true; @@ -445,7 +439,6 @@ class SapphireTest extends PHPUnit_Framework_TestCase { * {@link loadFixture()} */ public function clearFixtures() { - $this->fixtures = array(); $this->getFixtureFactory()->clear(); } diff --git a/dev/YamlFixture.php b/dev/YamlFixture.php index f8b1aaad2..356ecbc77 100644 --- a/dev/YamlFixture.php +++ b/dev/YamlFixture.php @@ -83,12 +83,6 @@ class YamlFixture extends Object { */ protected $fixtureString; - /** - * @var FixtureFactory - * @deprecated 3.1 Use writeInto() and FixtureFactory instead - */ - protected $factory; - /** * @param String Absolute file path, or relative path to {@link Director::baseFolder()} */ @@ -123,68 +117,6 @@ class YamlFixture extends Object { return $this->fixtureString; } - /** - * Get the ID of an object from the fixture. - * - * @deprecated 3.1 Use writeInto() and FixtureFactory accessors instead - * - * @param $className The data class, as specified in your fixture file. Parent classes won't work - * @param $identifier The identifier string, as provided in your fixture file - */ - public function idFromFixture($className, $identifier) { - Deprecation::notice('3.1', 'Use writeInto() and FixtureFactory accessors instead'); - - if(!$this->factory) $this->factory = Injector::inst()->create('FixtureFactory'); - return $this->factory->getId($className, $identifier); - - } - - /** - * Return all of the IDs in the fixture of a particular class name. - * - * @deprecated 3.1 Use writeInto() and FixtureFactory accessors instead - * - * @return A map of fixture-identifier => object-id - */ - public function allFixtureIDs($className) { - Deprecation::notice('3.1', 'Use writeInto() and FixtureFactory accessors instead'); - - if(!$this->factory) $this->factory = Injector::inst()->create('FixtureFactory'); - return $this->factory->getIds($className); - } - - /** - * Get an object from the fixture. - * - * @deprecated 3.1 Use writeInto() and FixtureFactory accessors instead - * - * @param $className The data class, as specified in your fixture file. Parent classes won't work - * @param $identifier The identifier string, as provided in your fixture file - */ - public function objFromFixture($className, $identifier) { - Deprecation::notice('3.1', 'Use writeInto() and FixtureFactory accessors instead'); - - if(!$this->factory) $this->factory = Injector::inst()->create('FixtureFactory'); - return $this->factory->get($className, $identifier); - } - - /** - * Load a YAML fixture file into the database. - * Once loaded, you can use idFromFixture() and objFromFixture() to get items from the fixture. - * - * Caution: In order to support reflexive relations which need a valid object ID, - * the record is written twice: first after populating all non-relational fields, - * then again after populating all relations (has_one, has_many, many_many). - * - * @deprecated 3.1 Use writeInto() and FixtureFactory instance instead - */ - public function saveIntoDatabase(DataModel $model) { - Deprecation::notice('3.1', 'Use writeInto() and FixtureFactory instance instead'); - - if(!$this->factory) $this->factory = Injector::inst()->create('FixtureFactory'); - $this->writeInto($this->factory); - } - /** * Persists the YAML data in a FixtureFactory, * which in turn saves them into the database. diff --git a/docs/en/changelogs/3.2.0.md b/docs/en/changelogs/3.2.0.md index b9e31c6e2..d4c65c464 100644 --- a/docs/en/changelogs/3.2.0.md +++ b/docs/en/changelogs/3.2.0.md @@ -13,6 +13,12 @@ * ClassInfo::dataClassesFor now returns classes which should have tables, regardless of whether those tables actually exist. * SS_Filterable, SS_Limitable and SS_Sortable now explicitly extend SS_List + * ToggleField was deprecated in 3.1, and has been removed. Use custom Javascript with ReadonlyField instead. + * ExactMatchMultiFilter was deprecated in 3.1, and has been removed. Use ExactMatchFilter instead. + * NegationFilter was deprecated in 3.1, and has been removed. Use ExactMatchFilter:not instead. + * StartsWithMultiFilter was deprecated in 3.1, and has been removed. Use StartsWithFilter instead. + * ScheduledTask and subclasses like DailyTask were deprecated in 3.1, and have been removed. + Use custom code instead, or a module like silverstripe-crontask: https://github.com/silverstripe-labs/silverstripe-crontask ### CMS diff --git a/docs/en/misc/release-process.md b/docs/en/misc/release-process.md index 05ec32e11..9055964b6 100644 --- a/docs/en/misc/release-process.md +++ b/docs/en/misc/release-process.md @@ -182,4 +182,4 @@ for the [framework](https://travis-ci.org/silverstripe/silverstripe-framework) a [cms](https://travis-ci.org/silverstripe/silverstripe-cms) modules. In addition, some build configurations (e.g. running on Windows) are tested through a [TeamCity](http://www.jetbrains.com/teamcity/) instance hosted at -[teamcity.silverstripe.com](http://teamcity.silverstripe.com) (click "Login as guest"). \ No newline at end of file +[teamcity.silverstripe.com](http://teamcity.silverstripe.com) (click "Login as guest"). diff --git a/docs/en/reference/form-field-types.md b/docs/en/reference/form-field-types.md index 5aeef002f..b47a57d59 100644 --- a/docs/en/reference/form-field-types.md +++ b/docs/en/reference/form-field-types.md @@ -45,7 +45,6 @@ doesn't necessarily have any visible styling. * `[api:TabSet]`: Collection of fields which is rendered as separate tabs. Can be nested. * `[api:Tab]`: A single tab inside a `TabSet`. * `[api:ToggleCompositeField]`: Allows visibility of a group of fields to be toggled. - * `[api:ToggleField]`: ReadonlyField with added toggle-capabilities - will preview the first sentence of the contained text-value, and show the full content by a javascript-switch. ## Files diff --git a/email/Mailer.php b/email/Mailer.php index 36a2955e4..73b3b9b9f 100644 --- a/email/Mailer.php +++ b/email/Mailer.php @@ -437,113 +437,3 @@ class Mailer extends Object { } } -/** - * @package framework - * @subpackage email - * @deprecated 3.1 - */ -function htmlEmail($to, $from, $subject, $htmlContent, $attachedFiles = false, $customheaders = false, - $plainContent = false) { - - Deprecation::notice('3.1', 'Use Email->sendHTML() instead'); - - $mailer = Injector::inst()->create('Mailer'); - return $mailer->sendHTML($to, $from, $subject, $plainContent, $attachedFiles, $customheaders = false); -} - -/** - * @package framework - * @subpackage email - * @deprecated 3.1 - */ -function plaintextEmail($to, $from, $subject, $plainContent, $attachedFiles, $customheaders = false) { - Deprecation::notice('3.1', 'Use Email->sendPlain() instead'); - - $mailer = Injector::inst()->create('Mailer'); - return $mailer->sendPlain($to, $from, $subject, $plainContent, $attachedFiles, $customheaders = false); -} - -/** - * @package framework - * @subpackage email - * @deprecated 3.1 - */ -function encodeMultipart($parts, $contentType, $headers = false) { - Deprecation::notice('3.1', 'Use Email->$this->encodeMultipart() instead'); - - $mailer = Injector::inst()->create('Mailer'); - return $mailer->encodeMultipart($parts, $contentType, $headers = false); -} - -/** - * @package framework - * @subpackage email - * @deprecated 3.1 - */ -function wrapImagesInline($htmlContent) { - Deprecation::notice('3.1', 'Functionality removed from core'); - - $mailer = Injector::inst()->create('Mailer'); - return $mailer->wrapImagesInline($htmlContent); -} - -/** - * @package framework - * @subpackage email - * @deprecated 3.1 - */ -function wrapImagesInline_rewriter($url) { - Deprecation::notice('3.1', 'Functionality removed from core'); - - $mailer = Injector::inst()->create('Mailer'); - return $mailer->wrapImagesInline_rewriter($url); - -} - -/** - * @package framework - * @subpackage email - * @deprecated 3.1 - */ -function processHeaders($headers, $body = false) { - Deprecation::notice('3.1', 'Set headers through Email->addCustomHeader()'); - - $mailer = Injector::inst()->create('Mailer'); - return $mailer->processHeaders($headers, $url); -} - -/** - * @package framework - * @subpackage email - * @deprecated 3.1 - */ -function encodeFileForEmail($file, $destFileName = false, $disposition = NULL, $extraHeaders = "") { - Deprecation::notice('3.1', 'Please add files through Email->attachFile()'); - - $mailer = Injector::inst()->create('Mailer'); - return $mailer->encodeFileForEmail($file, $destFileName, $disposition, $extraHeaders); -} - -/** - * @package framework - * @subpackage email - * @deprecated 3.1 - */ -function QuotedPrintable_encode($quotprint) { - Deprecation::notice('3.1', 'No longer available, handled internally'); - - $mailer = Injector::inst()->create('Mailer'); - return $mailer->QuotedPrintable_encode($quotprint); -} - -/** - * @package framework - * @subpackage email - * @deprecated 3.1 - */ -function validEmailAddr($emailAddress) { - Deprecation::notice('3.1', 'Use Email->validEmailAddr() instead'); - - $mailer = Injector::inst()->create('Mailer'); - return $mailer->validEmailAddr($emailAddress); -} diff --git a/forms/ToggleField.php b/forms/ToggleField.php deleted file mode 100644 index c8d15f931..000000000 --- a/forms/ToggleField.php +++ /dev/null @@ -1,100 +0,0 @@ -labelMore = _t('ToggleField.MORE', 'more'); - $this->labelLess = _t('ToggleField.LESS', 'less'); - - $this->startClosed(true); - - parent::__construct($name, $title, $value); - } - - public function Field($properties = array()) { - $content = ''; - - Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jquery/jquery.js'); - Requirements::javascript(FRAMEWORK_DIR . "/javascript/ToggleField.js"); - - if($this->startClosed) $this->addExtraClass('startClosed'); - - $valforInput = $this->value ? Convert::raw2att($this->value) : ""; - $rawInput = Convert::html2raw($valforInput); - - if($this->charNum) $reducedVal = substr($rawInput,0,$this->charNum); - else $reducedVal = DBField::create_field('Text',$rawInput)->{$this->truncateMethod}(); - - // only create togglefield if the truncated content is shorter - if(strlen($reducedVal) < strlen($rawInput)) { - $content = << - $reducedVal - $this->labelMore - -
- * class MyTask extends DailyTask {
- * function process() {
- * // implement your task here
- * }
- * }
- *
- *
- * You can also implement the index() method to overwrite which singleton classes are instantiated and processed.
- * By default, all subclasses of the task are instantiated and used. For the DailyTask class, this means
- * that an instance of each subclass of DailyTask will be created.
- *
- * You can test your task from the command line by running the following command
- * (replace framework/cli-script.php /
- *
- * To perform all Daily tasks, run from the command line:
- *
- * cli-script.php /DailyTask
- *
- * Example Cron Definition
- *
- *
- * # Quarter-hourly task (every hour at 25 minutes past) (remove space between first * and /15)
- * * /15 * * * * www-data /webroot/framework/cli-script.php /QuarterHourlyTask > /var/log/quarterhourlytask.log
- *
- * # HourlyTask (every hour at 25 minutes past)
- * 25 * * * * www-data /webroot/framework/cli-script.php /HourlyTask > /var/log/hourlytask.log
- *
- * # DailyTask (every day at 6:25am)
- * 25 6 * * * www-data /webroot/framework/cli-script.php /DailyTask > /var/log/dailytask.log
- *
- * # WeelkyTask (every Monday at 6:25am)
- * 25 6 1 * * www-data /webroot/framework/cli-script.php /WeeklyTask > /var/log/weeklytask.log
- *
- *
- * @deprecated 3.1
- *
- * @todo Improve documentation
- * @package framework
- * @subpackage cron
- */
-abstract class ScheduledTask extends CliController {
- // this class exists as a logical extension
-
- public function init() {
- Deprecation::notice(
- '3.1',
- 'ScheduledTask, QuarterHourlyTask, HourlyTask, DailyTask, MonthlyTask, WeeklyTask and ' .
- 'YearlyTask are deprecated, please extend from BuildTask or CliController, ' .
- 'and invoke them in self-defined frequencies through Unix cronjobs etc.'
- );
-
- parent::init();
- }
-}
diff --git a/tasks/WeeklyTask.php b/tasks/WeeklyTask.php
deleted file mode 100644
index 08ff4d10a..000000000
--- a/tasks/WeeklyTask.php
+++ /dev/null
@@ -1,16 +0,0 @@
- "Int"
- );
-
- private static $has_one = array('Bar' => 'AggregateTest_Bar');
- private static $belongs_many_many = array('Bazi' => 'AggregateTest_Baz');
-}
-
-class AggregateTest_Fab extends AggregateTest_Foo {
- private static $db = array(
- "Fab" => "Int"
- );
-}
-
-class AggregateTest_Fac extends AggregateTest_Fab {
- private static $db = array(
- "Fac" => "Int"
- );
-}
-
-class AggregateTest_Bar extends DataObject implements TestOnly {
- private static $db = array(
- "Bar" => "Int"
- );
-
- private static $has_many = array(
- "Foos" => "AggregateTest_Foo"
- );
-}
-
-class AggregateTest_Baz extends DataObject implements TestOnly {
- private static $db = array(
- "Baz" => "Int"
- );
-
- private static $many_many = array(
- "Foos" => "AggregateTest_Foo"
- );
-}
-
-class AggregateTest extends SapphireTest {
- protected static $fixture_file = 'AggregateTest.yml';
-
- protected $extraDataObjects = array(
- 'AggregateTest_Foo',
- 'AggregateTest_Fab',
- 'AggregateTest_Fac',
- 'AggregateTest_Bar',
- 'AggregateTest_Baz'
- );
-
- protected $originalDeprecation;
-
- public function setUp() {
- parent::setUp();
- // This test tests code that was deprecated after 2.4
- $this->originalDeprecation = Deprecation::dump_settings();
- Deprecation::notification_version('2.4');
- }
-
- public function tearDown() {
- parent::tearDown();
- Deprecation::restore_settings($this->originalDeprecation);
- }
-
- /**
- * Test basic aggregation on a passed type
- */
- public function testTypeSpecifiedAggregate() {
- $foo = $this->objFromFixture('AggregateTest_Foo', 'foo1');
-
- // Template style access
- $this->assertEquals($foo->Aggregate('AggregateTest_Foo')->XML_val('Max', array('Foo')), 9);
- $this->assertEquals($foo->Aggregate('AggregateTest_Fab')->XML_val('Max', array('Fab')), 3);
-
- // PHP style access
- $this->assertEquals($foo->Aggregate('AggregateTest_Foo')->Max('Foo'), 9);
- $this->assertEquals($foo->Aggregate('AggregateTest_Fab')->Max('Fab'), 3);
- }
- /* */
-
- /**
- * Test basic aggregation on a given dataobject
- * @return unknown_type
- */
- public function testAutoTypeAggregate() {
- $foo = $this->objFromFixture('AggregateTest_Foo', 'foo1');
- $fab = $this->objFromFixture('AggregateTest_Fab', 'fab1');
-
- // Template style access
- $this->assertEquals($foo->Aggregate()->XML_val('Max', array('Foo')), 9);
- $this->assertEquals($fab->Aggregate()->XML_val('Max', array('Fab')), 3);
-
- // PHP style access
- $this->assertEquals($foo->Aggregate()->Max('Foo'), 9);
- $this->assertEquals($fab->Aggregate()->Max('Fab'), 3);
- }
- /* */
-
- /**
- * Test base-level field access - was failing due to use of custom_database_fields, not just database_fields
- * @return unknown_type
- */
- public function testBaseFieldAggregate() {
- $foo = $this->objFromFixture('AggregateTest_Foo', 'foo1');
-
- $this->assertEquals(
- $this->formatDate($foo->Aggregate('AggregateTest_Foo')->Max('LastEdited')),
- $this->formatDate(DataObject::get_one('AggregateTest_Foo', '', '', '"LastEdited" DESC')->LastEdited)
- );
-
- $this->assertEquals(
- $this->formatDate($foo->Aggregate('AggregateTest_Foo')->Max('Created')),
- $this->formatDate(DataObject::get_one('AggregateTest_Foo', '', '', '"Created" DESC')->Created)
- );
- }
- /* */
-
- /**
- * Test aggregation takes place on the passed type & it's children only
- */
- public function testChildAggregate() {
- $foo = $this->objFromFixture('AggregateTest_Foo', 'foo1');
-
- // For base classes, aggregate is calculcated on it and all children classes
- $this->assertEquals($foo->Aggregate('AggregateTest_Foo')->Max('Foo'), 9);
-
- // For subclasses, aggregate is calculated for that subclass and it's children only
- $this->assertEquals($foo->Aggregate('AggregateTest_Fab')->Max('Foo'), 9);
- $this->assertEquals($foo->Aggregate('AggregateTest_Fac')->Max('Foo'), 6);
-
- }
- /* */
-
- /**
- * Test aggregates are cached properly
- */
- public function testCache() {
- $this->markTestIncomplete();
- }
- /* */
-
- /**
- * Test cache is correctly flushed on write
- */
- public function testCacheFlushing() {
- $foo = $this->objFromFixture('AggregateTest_Foo', 'foo1');
- $fab = $this->objFromFixture('AggregateTest_Fab', 'fab1');
-
- // For base classes, aggregate is calculcated on it and all children classes
- $this->assertEquals($fab->Aggregate('AggregateTest_Foo')->Max('Foo'), 9);
-
- // For subclasses, aggregate is calculated for that subclass and it's children only
- $this->assertEquals($fab->Aggregate('AggregateTest_Fab')->Max('Foo'), 9);
- $this->assertEquals($fab->Aggregate('AggregateTest_Fac')->Max('Foo'), 6);
-
- $foo->Foo = 12;
- $foo->write();
-
- // For base classes, aggregate is calculcated on it and all children classes
- $this->assertEquals($fab->Aggregate('AggregateTest_Foo')->Max('Foo'), 12);
-
- // For subclasses, aggregate is calculated for that subclass and it's children only
- $this->assertEquals($fab->Aggregate('AggregateTest_Fab')->Max('Foo'), 9);
- $this->assertEquals($fab->Aggregate('AggregateTest_Fac')->Max('Foo'), 6);
-
- $fab->Foo = 15;
- $fab->write();
-
- // For base classes, aggregate is calculcated on it and all children classes
- $this->assertEquals($fab->Aggregate('AggregateTest_Foo')->Max('Foo'), 15);
-
- // For subclasses, aggregate is calculated for that subclass and it's children only
- $this->assertEquals($fab->Aggregate('AggregateTest_Fab')->Max('Foo'), 15);
- $this->assertEquals($fab->Aggregate('AggregateTest_Fac')->Max('Foo'), 6);
- }
- /* */
-
- /**
- * Test basic relationship aggregation
- */
- public function testRelationshipAggregate() {
- $bar1 = $this->objFromFixture('AggregateTest_Bar', 'bar1');
- $this->assertEquals($bar1->RelationshipAggregate('Foos')->Max('Foo'), 8);
-
- $baz1 = $this->objFromFixture('AggregateTest_Baz', 'baz1');
- $this->assertEquals($baz1->RelationshipAggregate('Foos')->Max('Foo'), 8);
- }
- /* */
-
- /**
- * Copied from DataObject::__construct(), special case for MSSQLDatabase.
- *
- * @param String
- * @return String
- */
- protected function formatDate($dateStr) {
- $dateStr = preg_replace('/:[0-9][0-9][0-9]([ap]m)$/i', ' \\1', $dateStr);
- return date('Y-m-d H:i:s', strtotime($dateStr));
- }
-}
diff --git a/tests/model/AggregateTest.yml b/tests/model/AggregateTest.yml
deleted file mode 100644
index 4a8bc7242..000000000
--- a/tests/model/AggregateTest.yml
+++ /dev/null
@@ -1,46 +0,0 @@
-AggregateTest_Bar:
- bar1:
- Bar: 1
- bar2:
- Bar: 2
-AggregateTest_Foo:
- foo1:
- Foo: 1
- Bar: =>AggregateTest_Bar.bar1
- foo2:
- Foo: 2
- Bar: =>AggregateTest_Bar.bar1
- foo3:
- Foo: 3
- Bar: =>AggregateTest_Bar.bar2
-AggregateTest_Fab:
- fab1:
- Foo: 7
- Fab: 1
- Bar: =>AggregateTest_Bar.bar1
- fab2:
- Foo: 8
- Fab: 2
- Bar: =>AggregateTest_Bar.bar1
- fab3:
- Foo: 9
- Fab: 3
- Bar: =>AggregateTest_Bar.bar2
-AggregateTest_Fac:
- fac1:
- Foo: 4
- Fac: 1
- fac2:
- Foo: 5
- Fac: 2
- fac3:
- Foo: 6
- Fac: 3
-AggregateTest_Baz:
- baz1:
- Baz: 1
- Foos: =>AggregateTest_Foo.foo1,=>AggregateTest_Foo.foo2,=>AggregateTest_Fab.fab1,=>AggregateTest_Fab.fab2
- baz2:
- Baz: 2
- Foos: =>AggregateTest_Foo.foo3,=>AggregateTest_Fab.fab3
-
\ No newline at end of file