Skip to content

Commit 4878701

Browse files
Merge branch 'master' into 6.0
2 parents 9b0ec59 + 204ab86 commit 4878701

File tree

105 files changed

+531
-279
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+531
-279
lines changed

src/Backup/Crypter/OpenSSL.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,7 @@ public function crypt(Target $target, Result $result)
100100

101101
$result->warn($name . ': The ' . $this->algorithm . ' algorithm is considered weak');
102102
}
103-
104-
return parent::crypt($target, $result);
103+
parent::crypt($target, $result);
105104
}
106105

107106

@@ -115,10 +114,15 @@ public function simulate(Target $target, Result $result)
115114

116115
$result->warn($name . ': The ' . $this->algorithm . ' algorithm is considered weak');
117116
}
118-
119-
return parent::simulate($target, $result);
117+
parent::simulate($target, $result);
120118
}
121119

120+
/**
121+
* Is the configured cipher secure enough
122+
*
123+
* @return bool
124+
* @throws \phpbu\App\Backup\Crypter\Exception
125+
*/
122126
public function isUsingWeakAlgorithm(): bool
123127
{
124128
if (null === $this->algorithm) {

src/Log/Prometheus.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public function onPhpbuEnd(Event\App\End $event)
8787
$this->write('# HELP phpbu_backup_success Whether or not the backup succeeded' . PHP_EOL);
8888
$this->write('# TYPE phpbu_backup_success gauge' . PHP_EOL);
8989
foreach ($event->getResult()->getBackups() as $backupResult) {
90-
$this->write('phpbu_backup_success{name="' . $backupResult->getName() . '} ' . (int)$backupResult->allOk() . PHP_EOL);
90+
$this->write('phpbu_backup_success{name="' . $backupResult->getName() . '"} ' . (int)$backupResult->allOk() . PHP_EOL);
9191
}
9292

9393
$this->write(PHP_EOL);
@@ -96,23 +96,23 @@ public function onPhpbuEnd(Event\App\End $event)
9696
$this->write('# TYPE phpbu_backup_duration gauge' . PHP_EOL);
9797
foreach ($this->backupStats as $backupName => $backupStats) {
9898
$duration = $this->backupStats[$backupName]['timeEnd'] - $this->backupStats[$backupName]['timeStart'];
99-
$this->write('phpbu_backup_duration{name="' . $backupName . '} ' . $duration . PHP_EOL);
99+
$this->write('phpbu_backup_duration{name="' . $backupName . '"} ' . $duration . PHP_EOL);
100100
}
101101

102102
$this->write(PHP_EOL);
103103

104104
$this->write('# HELP phpbu_backup_last_run The unix timestamp of the last run' . PHP_EOL);
105105
$this->write('# TYPE phpbu_backup_last_run counter' . PHP_EOL);
106106
foreach ($this->backupStats as $backupName => $backupStats) {
107-
$this->write('phpbu_backup_last_run{name="' . $backupName . '} ' . (int)$this->backupStats[$backupName]['lastRun'] . PHP_EOL);
107+
$this->write('phpbu_backup_last_run{name="' . $backupName . '"} ' . (int)$this->backupStats[$backupName]['lastRun'] . PHP_EOL);
108108
}
109109

110110
$this->write(PHP_EOL);
111111

112112
$this->write('# HELP phpbu_backup_size The size of the last successful backup' . PHP_EOL);
113113
$this->write('# TYPE phpbu_backup_size gauge' . PHP_EOL);
114114
foreach ($this->backupStats as $backupName => $backupStats) {
115-
$this->write('phpbu_backup_size{name="' . $backupName . '} ' . $this->backupStats[$backupName]['size'] . PHP_EOL);
115+
$this->write('phpbu_backup_size{name="' . $backupName . '"} ' . $this->backupStats[$backupName]['size'] . PHP_EOL);
116116
}
117117

118118
}

tests/phpbu/Adapter/DotEnvTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<?php
22
namespace phpbu\App\Adapter;
33

4+
use PHPUnit\Framework\TestCase;
5+
46
/**
57
* Factory test
68
*
@@ -12,7 +14,7 @@
1214
* @link http://www.phpbu.de/
1315
* @since Class available since Release 1.1.5
1416
*/
15-
class DotenvTest extends \PHPUnit\Framework\TestCase
17+
class DotenvTest extends TestCase
1618
{
1719
/**
1820
* Tests DotEnv::setUp

tests/phpbu/Adapter/EnvTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<?php
22
namespace phpbu\App\Adapter;
33

4+
use PHPUnit\Framework\TestCase;
5+
46
/**
57
* Env test
68
*
@@ -12,7 +14,7 @@
1214
* @link http://www.phpbu.de/
1315
* @since Class available since Release 4.0.0
1416
*/
15-
class EnvTest extends \PHPUnit\Framework\TestCase
17+
class EnvTest extends TestCase
1618
{
1719
/**
1820
* Tests Env::setup

tests/phpbu/Adapter/PHPArrayTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<?php
22
namespace phpbu\App\Adapter;
33

4+
use PHPUnit\Framework\TestCase;
5+
46
/**
57
* Env test
68
*
@@ -12,7 +14,7 @@
1214
* @link http://www.phpbu.de/
1315
* @since Class available since Release 4.0.0
1416
*/
15-
class PHPArrayTest extends \PHPUnit\Framework\TestCase
17+
class PHPArrayTest extends TestCase
1618
{
1719
/**
1820
* Tests PHPArray::setup

tests/phpbu/Adapter/UtilTest.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<?php
22
namespace phpbu\App\Adapter;
33

4+
use PHPUnit\Framework\TestCase;
5+
46
/**
57
* Adapter Util test
68
*
@@ -12,7 +14,7 @@
1214
* @link http://www.phpbu.de/
1315
* @since Class available since Release 5.0.7
1416
*/
15-
class UtilTest extends \PHPUnit\Framework\TestCase
17+
class UtilTest extends TestCase
1618
{
1719
/**
1820
* Tests Util::getAdapterReplacements
@@ -21,7 +23,7 @@ public function testGetAdapterValuesSingle()
2123
{
2224
$values = Util::getAdapterReplacements('adapter:foo:bar');
2325

24-
$this->assertEquals(1, count($values));
26+
$this->assertCount(1, $values);
2527
$this->assertEquals('adapter:foo:bar', $values[0]['search']);
2628
$this->assertEquals('foo', $values[0]['adapter']);
2729
$this->assertEquals('bar', $values[0]['path']);
@@ -34,7 +36,7 @@ public function testGetAdapterValuesSinglePrefixed()
3436
{
3537
$values = Util::getAdapterReplacements(':AdaPteR:foo:bar');
3638

37-
$this->assertEquals(1, count($values));
39+
$this->assertCount(1, $values);
3840
$this->assertEquals(':AdaPteR:foo:bar', $values[0]['search']);
3941
$this->assertEquals('foo', $values[0]['adapter']);
4042
$this->assertEquals('bar', $values[0]['path']);
@@ -47,7 +49,7 @@ public function testGetAdapterValuesSinglePostfixed()
4749
{
4850
$values = Util::getAdapterReplacements('adapter:foo:bar:');
4951

50-
$this->assertEquals(1, count($values));
52+
$this->assertCount(1, $values);
5153
$this->assertEquals('adapter:foo:bar:', $values[0]['search']);
5254
$this->assertEquals('foo', $values[0]['adapter']);
5355
$this->assertEquals('bar', $values[0]['path']);
@@ -60,7 +62,7 @@ public function testGetAdapterValuesSinglePreAndPostfixed()
6062
{
6163
$values = Util::getAdapterReplacements(':adapter:foo:bar:');
6264

63-
$this->assertEquals(1, count($values));
65+
$this->assertCount(1, $values);
6466
$this->assertEquals(':adapter:foo:bar:', $values[0]['search']);
6567
$this->assertEquals('foo', $values[0]['adapter']);
6668
$this->assertEquals('bar', $values[0]['path']);
@@ -73,7 +75,7 @@ public function testGetAdapterValuesMultiple()
7375
{
7476
$values = Util::getAdapterReplacements('adapter:foo:bar:/some/path/:adapter:fiz:baz');
7577

76-
$this->assertEquals(2, count($values));
78+
$this->assertCount(2, $values);
7779
$this->assertEquals('adapter:foo:bar:', $values[0]['search']);
7880
$this->assertEquals('foo', $values[0]['adapter']);
7981
$this->assertEquals('bar', $values[0]['path']);
@@ -90,7 +92,7 @@ public function testGetAdapterValuesMultipleInBetween()
9092
{
9193
$values = Util::getAdapterReplacements('/some/:adapter:foo:bar:/path/:adapter:fiz:baz:/end/');
9294

93-
$this->assertEquals(2, count($values));
95+
$this->assertCount(2, $values);
9496
$this->assertEquals(':adapter:foo:bar:', $values[0]['search']);
9597
$this->assertEquals('foo', $values[0]['adapter']);
9698
$this->assertEquals('bar', $values[0]['path']);

tests/phpbu/Backup/Check/SizeMinTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<?php
22
namespace phpbu\App\Backup\Check;
33

4+
use PHPUnit\Framework\TestCase;
5+
46
/**
57
* SizeMinTest
68
*
@@ -12,7 +14,7 @@
1214
* @link http://www.phpbu.de/
1315
* @since Class available since Release 1.0.0
1416
*/
15-
class SizeMinTest extends \PHPUnit\Framework\TestCase
17+
class SizeMinTest extends TestCase
1618
{
1719
/**
1820
* Tests SizeMin::pass

tests/phpbu/Backup/Cleaner/OutdatedTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function testCleanupDeleteFiles()
9090
$collectorStub->method('getBackupFiles')->willReturn($fileList);
9191

9292
$cleaner = new Outdated();
93-
$cleaner->setup(array('older' => '3d'));
93+
$cleaner->setup(['older' => '3d']);
9494

9595
$cleaner->cleanup($targetStub, $collectorStub, $resultStub);
9696
}
@@ -164,7 +164,7 @@ public function testCleanupNotWritable()
164164
$collectorStub->method('getBackupFiles')->willReturn($fileList);
165165

166166
$cleaner = new Outdated();
167-
$cleaner->setup(array('older' => '3d'));
167+
$cleaner->setup(['older' => '3d']);
168168

169169
$cleaner->cleanup($targetStub, $collectorStub, $resultStub);
170170
}

tests/phpbu/Backup/Cleaner/Stepwise/Keeper/AllTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<?php
22
namespace phpbu\App\Backup\Cleaner\Stepwise\Keeper;
33

4+
use PHPUnit\Framework\TestCase;
5+
46
/**
57
* All test
68
*
@@ -12,7 +14,7 @@
1214
* @link http://www.phpbu.de/
1315
* @since Class available since Release 5.0.0
1416
*/
15-
class AllTest extends \PHPUnit\Framework\TestCase
17+
class AllTest extends TestCase
1618
{
1719
/**
1820
* Tests All::keep

tests/phpbu/Backup/Cleaner/Stepwise/Keeper/NoneTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<?php
22
namespace phpbu\App\Backup\Cleaner\Stepwise\Keeper;
33

4+
use PHPUnit\Framework\TestCase;
5+
46
/**
57
* All test
68
*
@@ -12,7 +14,7 @@
1214
* @link http://www.phpbu.de/
1315
* @since Class available since Release 5.0.0
1416
*/
15-
class NoneTest extends \PHPUnit\Framework\TestCase
17+
class NoneTest extends TestCase
1618
{
1719
/**
1820
* Tests None::keep

0 commit comments

Comments
 (0)