|
@@ 419-438 (lines=20) @@
|
| 416 |
|
* @test |
| 417 |
|
* @dataProvider unRotateByCycleProvider |
| 418 |
|
*/ |
| 419 |
|
public function okUnRotateByCycle($configPath, $hour) |
| 420 |
|
{ |
| 421 |
|
$message = "hoge"; |
| 422 |
|
$configPath = dirname(__FILE__) . "/Fixtures/${configPath}"; |
| 423 |
|
$logger = $this->getLotateLogger($configPath); |
| 424 |
|
|
| 425 |
|
// 現在時刻より$hour時間前のUnixTimeを取得 |
| 426 |
|
$now = intval(preg_replace('/^.*\s/', '', microtime())); |
| 427 |
|
$createdAt = $now - 3600 * $hour; |
| 428 |
|
$createdAtDate = date("YmdHis", $createdAt); |
| 429 |
|
$nowDate = date("YmdHis", $now); |
| 430 |
|
|
| 431 |
|
$writer = new FileWriter("/tmp/webstream.logtest.status"); |
| 432 |
|
$writer->write($createdAt); |
| 433 |
|
$writer->flush(); |
| 434 |
|
$writer->close(); |
| 435 |
|
$logger->info($message); |
| 436 |
|
|
| 437 |
|
$this->assertFileNotExists("/tmp/webstream.logtest.${createdAtDate}-${nowDate}.log"); |
| 438 |
|
} |
| 439 |
|
|
| 440 |
|
/** |
| 441 |
|
* 正常系 |
|
@@ 451-470 (lines=20) @@
|
| 448 |
|
* @test |
| 449 |
|
* @dataProvider rotateByCycleProvider |
| 450 |
|
*/ |
| 451 |
|
public function okRotateByCycle($configPath, $hour) |
| 452 |
|
{ |
| 453 |
|
$message = "hoge"; |
| 454 |
|
$configPath = dirname(__FILE__) . "/Fixtures/${configPath}"; |
| 455 |
|
$logger = $this->getLotateLogger($configPath); |
| 456 |
|
|
| 457 |
|
// 現在時刻より$hour時間前のUnixTimeを取得 |
| 458 |
|
$now = intval(preg_replace('/^.*\s/', '', microtime())); |
| 459 |
|
$createdAt = $now - 3600 * $hour; |
| 460 |
|
$createdAtDate = date("YmdHis", $createdAt); |
| 461 |
|
$nowDate = date("YmdHis", $now); |
| 462 |
|
|
| 463 |
|
$writer = new FileWriter("/tmp/webstream.logtest.status"); |
| 464 |
|
$writer->write($createdAt); |
| 465 |
|
$writer->flush(); |
| 466 |
|
$writer->close(); |
| 467 |
|
$logger->info($message); |
| 468 |
|
|
| 469 |
|
$this->assertFileExists("/tmp/webstream.logtest.${createdAtDate}-${nowDate}.log"); |
| 470 |
|
} |
| 471 |
|
|
| 472 |
|
/** |
| 473 |
|
* 正常系 |