Skip to content

Commit

Permalink
Fix phpcs
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Sep 28, 2018
1 parent 492b9c1 commit 73458f6
Showing 1 changed file with 38 additions and 10 deletions.
48 changes: 38 additions & 10 deletions test/phpunit/TakePosFunctionalTest.php
Expand Up @@ -20,8 +20,6 @@
* \file test/functional/TakePosFunctionalTest.php
* \ingroup takepos
* \brief Example Selenium test.
*
* Put detailed description here.
*/

namespace test\functional;
Expand Down Expand Up @@ -99,13 +97,17 @@ protected function byHref($value)

/**
* Global test setup
*
* @return void
*/
public static function setUpBeforeClass()
{
}

/**
* Unit test setup
*
* @return void
*/
public function setUp()
{
Expand All @@ -115,13 +117,17 @@ public function setUp()

/**
* Verify pre conditions
*
* @return void
*/
protected function assertPreConditions()
{
}

/**
* Handle Dolibarr authentication
*
* @return void
*/
private function authenticate()
{
Expand All @@ -142,6 +148,8 @@ private function authenticate()

/**
* Test enabling developer mode
*
* @return void
*/
public function testEnableDeveloperMode()
{
Expand All @@ -154,12 +162,14 @@ public function testEnableDeveloperMode()
$this->byName('update')->click();
// Page reloaded, we need a new XPath
$main_features_level = $this->byXPath($main_features_level_path);
return $this->assertEquals('2', $main_features_level->value(), "MAIN_FEATURES_LEVEL value is 2");
$this->assertEquals('2', $main_features_level->value(), "MAIN_FEATURES_LEVEL value is 2");
}

/**
* Test enabling the module
*
* @return void
*
* @depends testEnableDeveloperMode
*/
public function testModuleEnabled()
Expand All @@ -179,43 +189,49 @@ public function testModuleEnabled()
}
// Page reloaded, we need a new Xpath
$module_status_image = $this->byXPath($module_status_image_path);
return $this->assertContains('switch_on.png', $module_status_image->attribute('src'), "Module enabled");
$this->assertContains('switch_on.png', $module_status_image->attribute('src'), "Module enabled");
}

/**
* Test access to the configuration page
*
* @return void
*
* @depends testModuleEnabled
*/
public function testConfigurationPage()
{
$this->url('/custom/takepos/admin/setup.php');
$this->authenticate();
return $this->assertContains('takepos/admin/setup.php', $this->url(), 'Configuration page');
$this->assertContains('takepos/admin/setup.php', $this->url(), 'Configuration page');
}

/**
* Test access to the about page
*
* @return void
*
* @depends testConfigurationPage
*/
public function testAboutPage()
{
$this->url('/custom/takepos/admin/about.php');
$this->authenticate();
return $this->assertContains('takepos/admin/about.php', $this->url(), 'About page');
$this->assertContains('takepos/admin/about.php', $this->url(), 'About page');
}

/**
* Test about page is rendering Markdown
*
* @return void
*
* @depends testAboutPage
*/
public function testAboutPageRendersMarkdownReadme()
{
$this->url('/custom/takepos/admin/about.php');
$this->authenticate();
return $this->assertEquals(
$this->assertEquals(
'Dolibarr Module Template (aka My Module)',
$this->byTag('h1')->text(),
"Readme title"
Expand All @@ -225,25 +241,29 @@ public function testAboutPageRendersMarkdownReadme()
/**
* Test box is properly declared
*
* @return void
*
* @depends testModuleEnabled
*/
public function testBoxDeclared()
{
$this->url('/admin/boxes.php');
$this->authenticate();
return $this->assertContains('takeposwidget1', $this->source(), "Box enabled");
$this->assertContains('takeposwidget1', $this->source(), "Box enabled");
}

/**
* Test trigger is properly enabled
*
* @return void
*
* @depends testModuleEnabled
*/
public function testTriggerDeclared()
{
$this->url('/admin/triggers.php');
$this->authenticate();
return $this->assertContains(
$this->assertContains(
'interface_99_modTakePos_TakePosTriggers.class.php',
$this->byTag('body')->text(),
"Trigger declared"
Expand All @@ -253,13 +273,15 @@ public function testTriggerDeclared()
/**
* Test trigger is properly declared
*
* @return void
*
* @depends testTriggerDeclared
*/
public function testTriggerEnabled()
{
$this->url('/admin/triggers.php');
$this->authenticate();
return $this->assertContains(
$this->assertContains(
'tick.png',
$this->byXPath('//td[text()="interface_99_modTakePos_MyTrigger.class.php"]/following::img')->attribute('src'),
"Trigger enabled"
Expand All @@ -268,20 +290,26 @@ public function testTriggerEnabled()

/**
* Verify post conditions
*
* @return void
*/
protected function assertPostConditions()
{
}

/**
* Unit test teardown
*
* @return void
*/
public function tearDown()
{
}

/**
* Global test teardown
*
* @return void
*/
public static function tearDownAfterClass()
{
Expand Down

0 comments on commit 73458f6

Please sign in to comment.