예제 #1
0
 public function testKeep()
 {
     $rotate = new Rotate('tests/test-files/orders.log');
     $this->assertEquals(10, $rotate->getKeepNumber());
     $rotate->keep(20);
     $this->assertEquals(20, $rotate->getKeepNumber());
 }
예제 #2
0
 public function testRotate2()
 {
     $oldDir = getcwd();
     chdir($this->dir . '/rotate2');
     $rotate = new Rotate('orders.log');
     $rotate->keep(3);
     $rotate->run();
     $this->assertFalse(file_exists('orders.log'));
     $this->assertTrue(file_exists('orders.log.1'));
     $this->assertTrue(file_exists('orders.log.2'));
     $this->assertTrue(file_exists('orders.log.3'));
     touch('orders.log');
     $rotate->run();
     $this->assertFalse(file_exists('orders.log'));
     $this->assertTrue(file_exists('orders.log.1'));
     $this->assertTrue(file_exists('orders.log.2'));
     $this->assertTrue(file_exists('orders.log.3'));
     $this->assertFalse(file_exists('orders.log.4'));
     chdir($oldDir);
 }