public function testValidate(UnitTester $I)
 {
     $data = ['host' => 'localhost', 'dbuser' => 'homestead', 'password' => 'secret', 'port' => '3306', 'database' => 'stigma'];
     $installManager = \App::make('Stigma\\Installation\\InstallManager');
     $databaseInstallation = $installManager->getDatabaseInstallation();
     $I->assertTrue($databaseInstallation->setup($data));
     $I->expectedInvalidParameterException(function () use($data, $databaseInstallation) {
         $tmpData = $data;
         unset($tmpData['host']);
         $databaseInstallation->setup($tmpData);
     });
     $I->expectedInvalidParameterException(function () use($data, $databaseInstallation) {
         $tmpData = $data;
         unset($tmpData['dbuser']);
         $databaseInstallation->setup($tmpData);
     });
     $I->expectedInvalidParameterException(function () use($data, $databaseInstallation) {
         $tmpData = $data;
         unset($tmpData['password']);
         $databaseInstallation->setup($tmpData);
     });
     $I->expectedInvalidParameterException(function () use($data, $databaseInstallation) {
         $tmpData = $data;
         unset($tmpData['port']);
         $databaseInstallation->setup($tmpData);
     });
 }
 public function testPasses(UnitTester $I)
 {
     $nagiosParameterValidation = \App::make('Stigma\\Installation\\Validators\\NagiosParameterValidation');
     $data = ['host' => 'localhost', 'port' => 80];
     $I->assertTrue($nagiosParameterValidation->passes($data));
     $I->expectedInvalidParameterException(function () use($nagiosParameterValidation) {
         $data = [];
         $nagiosParameterValidation->passes($data);
     });
 }
 public function testValidate(UnitTester $I)
 {
     $data = ['host' => 'localhost', 'dbuser' => 'homestead', 'password' => 'secret', 'port' => '3306', 'database' => 'stigma'];
     $dbConnectionValidation = new DatabaseConnectionValidation();
     $I->assertTrue($dbConnectionValidation->passes($data));
     $I->expectedPdoException(function () {
         $data = ['host' => 'localhost', 'dbuser' => 'homestead', 'password' => 'secret2', 'port' => '3306', 'database' => 'stigma'];
         $dbConnectionValidation = new DatabaseConnectionValidation();
         $dbConnectionValidation->passes($data);
     });
 }
예제 #4
0
 public function testSetup(UnitTester $I)
 {
     $data = ['host' => 'localhost', 'port' => '80'];
     $installManager = \App::make('Stigma\\Installation\\InstallManager');
     $nagiosInstallation = $installManager->getNagiosInstallation();
     $ret = $nagiosInstallation->setup($data);
     $stubFile = file_get_contents(__DIR__ . '/../' . '_stubs/nagios.php');
     $createdFile = file_get_contents(config_path() . '/nagios.php');
     $I->assertTrue($ret);
     $I->assertFileExists(config_path() . '/nagios.php');
     $I->assertEquals($stubFile, $createdFile);
 }
 public function tryToSetup(UnitTester $I)
 {
     if (file_exists(config_path() . '/influxdb.php')) {
         $I->deleteFile(config_path() . '/influxdb.php');
     }
     $data = ['host' => 'localhost', 'database' => 'stigma', 'username' => 'username', 'password' => 'password'];
     $installManager = \App::make('Stigma\\Installation\\InstallManager');
     $influxdbInstallation = $installManager->getInfluxdbInstallation();
     $ret = $influxdbInstallation->setup($data);
     $stubFile = file_get_contents(__DIR__ . '/../' . '_stubs/influxdb.php');
     $createdFile = file_get_contents(config_path() . '/influxdb.php');
     $I->assertTrue($ret);
     $I->assertFileExists(config_path() . '/influxdb.php');
     $I->assertEquals($stubFile, $createdFile);
 }
예제 #6
0
 public function testToCheck(UnitTester $I)
 {
     $installChecker = new InstallChecker(__DIR__ . '/../_tmp');
     $ret = $installChecker->check();
     $I->assertTrue($ret);
 }