2009-08-06 23:41:49 +02:00
< ? php
/**
* @ package cms
* @ subpackage tests
*/
2013-01-17 01:27:14 +01:00
class CmsReportsTest extends SapphireTest {
2011-03-30 09:04:31 +02:00
2013-01-17 01:27:14 +01:00
public static $fixture_file = 'CmsReportsTest.yml' ;
2011-03-30 09:04:31 +02:00
2013-01-17 01:27:14 +01:00
public static $daysAgo = 14 ;
2009-08-06 23:41:49 +02:00
2012-09-19 12:07:46 +02:00
public function setUp () {
2009-08-06 23:41:49 +02:00
parent :: setUp ();
// set the dates by hand: impossible to set via yml
2013-01-17 01:27:14 +01:00
$afterThreshold = strtotime ( '-' . ( self :: $daysAgo - 1 ) . ' days' , strtotime ( '31-06-2009 00:00:00' ));
$beforeThreshold = strtotime ( '-' . ( self :: $daysAgo + 1 ) . ' days' , strtotime ( '31-06-2009 00:00:00' ));
2009-08-06 23:41:49 +02: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 . " ' " );
}
2012-09-19 12:07:46 +02:00
public 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' );
2013-01-17 01:27:14 +01:00
$r = new RecentlyEditedReport ();
2009-08-06 23:41:49 +02:00
// 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
}