public function testLogRotate() { $SofortLibLogger = new fileLogger(); $SofortLibLogger->maxFilesize = 1; $SofortLibLogger->log('Aged, tangy pudding is best whisked with hot cream.What’s the secret to a sour and shredded cauliflower? Always use crushed vodka.'); $SofortLibLogger->log('Brush the tuna with sticky garlic, szechuan pepper, dill, and butterscotch making sure to cover all of it.'); $SofortLibLogger->log('Caviar pudding has to have a tasty, whole rice component.'); $SofortLibLogger->log('Try marinating the milk garlics with nutty condensed milk and bourbon, refrigerated.'); $SofortLibLogger->log('Shrimps taste best with anchovy essence and lots of nutmeg.'); $SofortLibLogger->log('Soak one package of cabbage in one cup of joghurt.'); $SofortLibLogger->log('Clammy, quartered pudding is best mixed with divided salsa verde.'); }
/** * Test the default storage interface. */ public function test_file_interface() { $fl = new fileLogger(); // Nothing logged, this should be empty: $this->assertEmpty($fl->isInAlert('foofail')); // Write a failure, see if it was written: $fl->writeAlert('foofail', 0); $log = $fl->readAlerts('foofail'); $this->assertNotEquals('barfail', $log[0]['check']); $this->assertEquals('foofail', $log[0]['check']); $this->assertEquals(0, $log[0]['status']); // Write a success, see if it was written: $fl->writeAlert('foofail', 1); $log = $fl->readAlerts('foofail'); $this->assertNotEquals('barfail', $log[1]['check']); $this->assertEquals('foofail', $log[1]['check']); $this->assertEquals(1, $log[1]['status']); // Reset alerts, confirm that the log is empty: $fl->resetAlerts('foofail'); $this->assertEmpty($fl->isInAlert('foofail')); // Since order is important for determining alert clears, see if slamming // the interface breaks things. $test_values = array(); for ($i = 0; $i < 100; $i++) { $rand = rand(0, 1); $test_values[] = $rand; $fl->writeAlert('megacount', $rand); } $log = $fl->readAlerts('megacount'); $this->assertEquals(100, count($log)); foreach ($test_values as $k => $v) { $this->assertEquals($v, $log[$k]['status']); } // Reset alerts, confirm again that the log is empty: $fl->resetAlerts('megacount'); $this->assertEmpty($fl->isInAlert('megacount')); }
public function testLogWriting() { $SofortLibLogger = new fileLogger(); $this->assertTrue($SofortLibLogger->log('test', 'log')); }