コード例 #1
0
ファイル: AggregationTest.php プロジェクト: linuxwhy/tiki-1
 function testConsiderPerPeriod()
 {
     $lib = new RatingLib();
     $lib->record_user_vote('abc', 'test', 111, 5, time() - 3000);
     // kept
     $lib->record_user_vote('abc', 'test', 111, 2, time() - 2000);
     // kept
     $lib->record_user_vote('abc', 'test', 111, 3, time() - 1000);
     $lib->record_anonymous_vote('deadbeef01234567', 'test', 111, 3, time() - 1000);
     // kept
     $this->assertEquals(10.0, $lib->collect('test', 111, 'sum', array('keep' => 'oldest', 'revote' => 2500)));
     $this->assertEquals(10 / 3, $lib->collect('test', 111, 'avg', array('keep' => 'oldest', 'revote' => 2500)), '', 1 / 1000);
 }
コード例 #2
0
ファイル: RegisterVoteTest.php プロジェクト: linuxwhy/tiki-1
 function testCannotRecordOnUnknownObjectType()
 {
     $lib = new RatingLib();
     $this->assertFalse($lib->record_user_vote('abc', 'foobar', 111, 4));
     $this->assertEquals(array(), $this->getTestData());
 }