@@ -7,26 +7,26 @@ discard block |
||
| 7 | 7 | class OptionBuildTest extends TestCase |
| 8 | 8 | { |
| 9 | 9 | |
| 10 | - private $cache; |
|
| 11 | - private $cacheDir; |
|
| 10 | + private $cache; |
|
| 11 | + private $cacheDir; |
|
| 12 | 12 | |
| 13 | - protected function setUp(): void |
|
| 14 | - { |
|
| 13 | + protected function setUp(): void |
|
| 14 | + { |
|
| 15 | 15 | $this->cacheDir = __DIR__ . '/cache'; |
| 16 | 16 | if (!file_exists($this->cacheDir) || !is_dir($this->cacheDir)) { |
| 17 | - mkdir($this->cacheDir, 0755, true); |
|
| 17 | + mkdir($this->cacheDir, 0755, true); |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | $this->cache = new Cacheer(); |
| 21 | - } |
|
| 21 | + } |
|
| 22 | 22 | |
| 23 | - protected function tearDown(): void |
|
| 24 | - { |
|
| 23 | + protected function tearDown(): void |
|
| 24 | + { |
|
| 25 | 25 | $this->cache->flushCache(); |
| 26 | - } |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | - public function test_it_can_set_cache_directory() |
|
| 29 | - { |
|
| 28 | + public function test_it_can_set_cache_directory() |
|
| 29 | + { |
|
| 30 | 30 | $cacheDir = __DIR__ . "/cache"; |
| 31 | 31 | |
| 32 | 32 | $options = OptionBuilder::forFile() |
@@ -35,23 +35,23 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | $this->assertArrayHasKey('cacheDir', $options); |
| 37 | 37 | $this->assertEquals($cacheDir, $options['cacheDir']); |
| 38 | - } |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | 40 | |
| 41 | - public function test_it_can_set_expiration_time() |
|
| 41 | + public function test_it_can_set_expiration_time() |
|
| 42 | 42 | { |
| 43 | 43 | |
| 44 | - $options = OptionBuilder::forFile() |
|
| 45 | - ->expirationTime('2 hours') |
|
| 46 | - ->build(); |
|
| 44 | + $options = OptionBuilder::forFile() |
|
| 45 | + ->expirationTime('2 hours') |
|
| 46 | + ->build(); |
|
| 47 | 47 | |
| 48 | - $this->assertArrayHasKey('expirationTime', $options); |
|
| 49 | - $this->assertEquals('2 hours', $options['expirationTime']); |
|
| 48 | + $this->assertArrayHasKey('expirationTime', $options); |
|
| 49 | + $this->assertEquals('2 hours', $options['expirationTime']); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | public function test_it_can_set_flush_after() |
| 53 | 53 | { |
| 54 | - $options = OptionBuilder::forFile() |
|
| 54 | + $options = OptionBuilder::forFile() |
|
| 55 | 55 | ->flushAfter('11 seconds') |
| 56 | 56 | ->build(); |
| 57 | 57 | |
@@ -61,9 +61,9 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | public function test_it_can_set_multiple_options_together() |
| 63 | 63 | { |
| 64 | - $cacheDir = __DIR__ . "/cache"; |
|
| 64 | + $cacheDir = __DIR__ . "/cache"; |
|
| 65 | 65 | |
| 66 | - $options = OptionBuilder::forFile() |
|
| 66 | + $options = OptionBuilder::forFile() |
|
| 67 | 67 | ->dir($cacheDir) |
| 68 | 68 | ->expirationTime('1 day') |
| 69 | 69 | ->flushAfter('30 minutes') |
@@ -76,41 +76,41 @@ discard block |
||
| 76 | 76 | ], $options); |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - public function test_it_allows_setting_expiration_time_with_timebuilder() |
|
| 79 | + public function test_it_allows_setting_expiration_time_with_timebuilder() |
|
| 80 | 80 | { |
| 81 | - $options = OptionBuilder::forFile()->expirationTime()->week(1)->build(); |
|
| 82 | - $this->assertArrayHasKey('expirationTime', $options); |
|
| 83 | - $this->assertEquals('1 weeks', $options['expirationTime']); |
|
| 81 | + $options = OptionBuilder::forFile()->expirationTime()->week(1)->build(); |
|
| 82 | + $this->assertArrayHasKey('expirationTime', $options); |
|
| 83 | + $this->assertEquals('1 weeks', $options['expirationTime']); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - public function test_it_allows_setting_flush_after_with_timebuilder() |
|
| 87 | - { |
|
| 86 | + public function test_it_allows_setting_flush_after_with_timebuilder() |
|
| 87 | + { |
|
| 88 | 88 | $options = OptionBuilder::forFile()->flushAfter()->second(10)->build(); |
| 89 | 89 | $this->assertArrayHasKey('flushAfter', $options); |
| 90 | 90 | $this->assertEquals('10 seconds', $options['flushAfter']); |
| 91 | - } |
|
| 91 | + } |
|
| 92 | 92 | |
| 93 | - public function test_it_can_set_multiple_options_together_with_timebuilder() |
|
| 94 | - { |
|
| 93 | + public function test_it_can_set_multiple_options_together_with_timebuilder() |
|
| 94 | + { |
|
| 95 | 95 | $cacheDir = __DIR__ . "/cache"; |
| 96 | 96 | $options = OptionBuilder::forFile() |
| 97 | - ->dir($cacheDir) |
|
| 98 | - ->expirationTime()->week(1) |
|
| 99 | - ->flushAfter()->minute(10) |
|
| 100 | - ->build(); |
|
| 97 | + ->dir($cacheDir) |
|
| 98 | + ->expirationTime()->week(1) |
|
| 99 | + ->flushAfter()->minute(10) |
|
| 100 | + ->build(); |
|
| 101 | 101 | |
| 102 | 102 | $this->assertEquals([ |
| 103 | 103 | 'cacheDir' => $cacheDir, |
| 104 | 104 | 'expirationTime' => '1 weeks', |
| 105 | 105 | 'flushAfter' => '10 minutes', |
| 106 | 106 | ], $options); |
| 107 | - } |
|
| 107 | + } |
|
| 108 | 108 | |
| 109 | - public function test_it_returns_empty_array_when_no_options_are_set() |
|
| 110 | - { |
|
| 109 | + public function test_it_returns_empty_array_when_no_options_are_set() |
|
| 110 | + { |
|
| 111 | 111 | $options = OptionBuilder::forFile()->build(); |
| 112 | 112 | $this->assertIsArray($options); |
| 113 | 113 | $this->assertEmpty($options); |
| 114 | - } |
|
| 114 | + } |
|
| 115 | 115 | |
| 116 | 116 | } |