public function testToFailWhenParametersAreInvalid(UnitTester $I) { $I->expectedInvalidParameterException(function () { $data = ['host' => 'localhost']; $installManager = \App::make('Stigma\\Installation\\InstallManager'); $influxdbInstallation = $installManager->getInfluxdbInstallation(); $influxdbInstallation->setup($data); }); }
public function testValidate(UnitTester $I) { $I->expectedInvalidParameterException(function () { $data = ['host' => 'localhost']; $installManager = \App::make('Stigma\\Installation\\InstallManager'); $nagiosInstallation = $installManager->getNagiosInstallation(); $nagiosInstallation->setup($data); }); }
public function testFileGenerate(UnitTester $I) { $data = ['host' => 'localhost', 'port' => '80']; $fileGenerator = new NagiosFileGenerator(__DIR__ . '../../../src/tmpl/nagios.php', config_path() . '/nagios.php'); $fileGenerator->make($data); $stubFile = file_get_contents(__DIR__ . '/../' . '_stubs/nagios.php'); $createdDbFile = file_get_contents(config_path() . '/nagios.php'); $I->assertFileExists(config_path() . '/nagios.php'); $I->assertEquals($stubFile, $createdDbFile); }
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); }); }
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 testToCheckWhenFilesAreNotExisted(UnitTester $I) { $installChecker = new InstallChecker(__DIR__ . '/../_tmps'); $ret = $installChecker->check(); $I->assertFalse($ret); }