Skip to content

Commit

Permalink
function Comment Missing
Browse files Browse the repository at this point in the history
  • Loading branch information
frederic34 committed Aug 31, 2018
1 parent e47059f commit b015d05
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 2 deletions.
6 changes: 6 additions & 0 deletions htdocs/core/lib/fichinter.lib.php
Expand Up @@ -163,6 +163,12 @@ function fichinter_admin_prepare_head()
return $head;
}

/**
* Prepare array with list of tabs
*
* @param Object $object Object related to tabs
* @return array Array of tabs to show
*/
function fichinter_rec_prepare_head($object)
{
global $langs, $conf; //, $user;
Expand Down
14 changes: 12 additions & 2 deletions test/phpunit/BonPrelevementTest.php
Expand Up @@ -74,14 +74,24 @@ function __construct()
print "\n";
}

// Static methods
public static function setUpBeforeClass()
/**
* setUpBeforeClass
*
* @return void
*/
public static function setUpBeforeClass()
{
global $conf,$user,$langs,$db;
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.

print __METHOD__."\n";
}

/**
* tearDownAfterClass
*
* @return void
*/
public static function tearDownAfterClass()
{
global $conf,$user,$langs,$db;
Expand Down
75 changes: 75 additions & 0 deletions test/phpunit/functional/InstallTest.php
Expand Up @@ -42,6 +42,11 @@ class InstallTest extends PHPUnit_Extensions_Selenium2TestCase
)
);

/**
* setUpBeforeClass
*
* @return void
*/
public static function setUpBeforeClass()
{
// Make sure we backup and remove the configuration file to force new install.
Expand All @@ -54,12 +59,22 @@ public static function setUpBeforeClass()
self::shareSession(true);
}

/**
* dropTestDatabase
*
* @return void
*/
protected static function dropTestDatabase()
{
$mysqli = new mysqli(self::$db_host, self::$db_admin_user, self::$db_admin_pass);
$mysqli->query("DROP DATABASE " . self::$db_name);
}

/**
* tearDownAfterClass
*
* @return void
*/
public static function tearDownAfterClass()
{
// Remove the generated configuration and restore the backed up file.
Expand All @@ -70,31 +85,56 @@ public static function tearDownAfterClass()
self::dropTestDatabase();
}

/**
* setUp
*
* @return void
*/
public function setUp()
{
// Populating the database can take quite long.
$this->setSeleniumServerRequestsTimeout(120000);
$this->setBrowserUrl(self::$url);
}

/**
* testInstallRedirect
*
* @return void
*/
public function testInstallRedirect()
{
$this->url('/');
$this->assertContains('/install/index.php', $this->url());
}

/**
* testInstallPageTitle
*
* @return void
*/
public function testInstallPageTitle()
{
$this->assertContains('Dolibarr', $this->title());
}

/**
* testInstallProcess
*
* @return void
*/
public function testInstallProcess()
{
// FIXME: the button itself should have an ID
$this->byId('nextbutton')->byTag('input')->click();
$this->assertContains('/install/check.php', $this->url());
}

/**
* testCheckPage
*
* @return void
*/
public function testCheckPage()
{
$unavailable_choices = $this->byId('navail_choices');
Expand All @@ -109,6 +149,11 @@ public function testCheckPage()
$this->assertContains('/install/fileconf.php', $this->url());
}

/**
* testForm
*
* @return void
*/
public function testForm()
{
$this->assertFalse($this->byClassName('hideroot')->displayed());
Expand Down Expand Up @@ -153,12 +198,22 @@ public function testForm()
$this->byId('db_pass_root')->value('');
}

/**
* testFormSubmit
*
* @return void
*/
public function testFormSubmit()
{
$this->byName('forminstall')->submit();
$this->assertContains('/install/step1.php', $this->url());
}

/**
* testStep1
*
* @return void
*/
public function testStep1()
{
$this->assertFalse($this->byId('pleasewait')->displayed());
Expand All @@ -170,6 +225,11 @@ public function testStep1()
$this->assertContains('/install/step2.php', $this->url());
}

/**
* testStep2
*
* @return void
*/
public function testStep2()
{
$this->byName('forminstall')->submit();
Expand All @@ -178,6 +238,11 @@ public function testStep2()

// There is no step 3

/**
* testStep4
*
* @return void
*/
public function testStep4()
{
// FIXME: should have an ID
Expand All @@ -191,13 +256,23 @@ public function testStep4()
$this->assertContains('/install/step5.php', $this->url());
}

/**
* testStep5
*
* @return void
*/
public function testStep5()
{
// FIXME: this button should have an ID
$this->byTag('a')->click();
$this->assertContains('/admin/index.php', $this->url());
}

/**
* testFirstLogin
*
* @return void
*/
public function testFirstLogin()
{
$this->assertEquals('login', $this->byTag('form')->attribute('id'));
Expand Down

0 comments on commit b015d05

Please sign in to comment.