public function testLastBackupsIdentical() { $meta = $this->getMeta(123123123123.0); $this->fs->getSize('s77_mail_2015-04-22.tar.gz')->willReturn($meta); $this->fs->getSize('s77_mail_2015-04-21.tar.gz')->willReturn($meta); $result = $this->assert->assertBackups(new \DateTime('2015-04-22')); $this->assertEquals("Laatste twee e-mail backups zijn even groot.", $result); }
<?php namespace root; use Frlnc\Slack\Core\Commander; use Frlnc\Slack\Http\CurlInteractor; use Frlnc\Slack\Http\SlackResponseFactory; use League\Flysystem\Filesystem; use League\Flysystem\Adapter\Ftp; require 'vendor/autoload.php'; require 'Assert.php'; $config = (include 'config.php'); function report($message) { global $config; $interactor = new CurlInteractor(); $interactor->setResponseFactory(new SlackResponseFactory()); $commander = new Commander($config['slack'], $interactor); $commander->execute('chat.postMessage', ['username' => 'Backup validator', 'icon_emoji' => ':x:', 'channel' => '#server', 'text' => $message]); } $filesystem = new Filesystem(new Ftp($config['ftp'])); $assert = new Assert($filesystem); $result = $assert->assertBackups(new \DateTime()); if ($result !== true) { report('Waarschuwing: ' . $result); }