2009-08-06 23:41:49 +02:00
< ? php
/**
* @ package cms
* @ subpackage tests
*/
class SideReportTest extends SapphireTest {
2011-03-30 09:04:31 +02:00
static $fixture_file = 'SideReportTest.yml' ;
2009-08-06 23:41:49 +02:00
static $daysAgo = 14 ;
function setUp () {
parent :: setUp ();
// set the dates by hand: impossible to set via yml
$afterThreshold = strtotime ( '-' . ( SideReportTest :: $daysAgo - 1 ) . ' days' , strtotime ( '31-06-2009 00:00:00' ));
$beforeThreshold = strtotime ( '-' . ( SideReportTest :: $daysAgo + 1 ) . ' days' , strtotime ( '31-06-2009 00:00:00' ));
$after = $this -> objFromFixture ( 'SiteTree' , 'after' );
$before = $this -> objFromFixture ( 'SiteTree' , 'before' );
DB :: query ( " UPDATE \" SiteTree \" SET \" Created \" ='2009-01-01 00:00:00', \" LastEdited \" =' " . date ( 'Y-m-d H:i:s' , $afterThreshold ) . " ' WHERE \" ID \" =' " . $after -> ID . " ' " );
DB :: query ( " UPDATE \" SiteTree \" SET \" Created \" ='2009-01-01 00:00:00', \" LastEdited \" =' " . date ( 'Y-m-d H:i:s' , $beforeThreshold ) . " ' WHERE \" ID \" =' " . $before -> ID . " ' " );
}
function testRecentlyEdited () {
API CHANGE: Renamed conflicting classes to have an "SS_" namespace, and renamed existing "SS" namespace to "SS_". The affected classes are: HTTPRequest, HTTPResponse, Query, Database, SSBacktrace, SSCli, SSDatetime, SSDatetimeTest, SSLog, SSLogTest, SSLogEmailWriter, SSLogErrorEmailFormatter, SSLogErrorFileFormatter, SSLogFileWriter and SSZendLog.
MINOR: Replaced usage of renamed classes with the new namespaced name.
From: Sam Minnee <sam@silverstripe.com>
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@90076 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-10-26 04:06:42 +01:00
SS_Datetime :: set_mock_now ( '31-06-2009 00:00:00' );
2009-08-06 23:41:49 +02:00
$after = $this -> objFromFixture ( 'SiteTree' , 'after' );
$before = $this -> objFromFixture ( 'SiteTree' , 'before' );
$r = new SideReport_RecentlyEdited ();
// check if contains only elements not older than $daysAgo days
2010-05-28 04:30:46 +02:00
$this -> assertNotNull ( $r -> records ( array ()));
$this -> assertContains ( $after -> ID , $r -> records ( array ()) -> column ( 'ID' ));
$this -> assertNotContains ( $before -> ID , $r -> records ( array ()) -> column ( 'ID' ));
2009-08-06 23:41:49 +02:00
API CHANGE: Renamed conflicting classes to have an "SS_" namespace, and renamed existing "SS" namespace to "SS_". The affected classes are: HTTPRequest, HTTPResponse, Query, Database, SSBacktrace, SSCli, SSDatetime, SSDatetimeTest, SSLog, SSLogTest, SSLogEmailWriter, SSLogErrorEmailFormatter, SSLogErrorFileFormatter, SSLogFileWriter and SSZendLog.
MINOR: Replaced usage of renamed classes with the new namespaced name.
From: Sam Minnee <sam@silverstripe.com>
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@90076 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-10-26 04:06:42 +01:00
SS_DateTime :: clear_mock_now ();
2009-08-06 23:41:49 +02:00
}
2012-04-12 09:23:20 +02:00
}