Skip to content

Commit

Permalink
Merge pull request #6 from pkolomiy/request
Browse files Browse the repository at this point in the history
Added tests for certificate and domain prices
  • Loading branch information
SilverFire committed Aug 28, 2018
2 parents edfd407 + 9ef3eb1 commit 5c10887
Show file tree
Hide file tree
Showing 7 changed files with 152 additions and 0 deletions.
13 changes: 13 additions & 0 deletions codeception.yml
@@ -0,0 +1,13 @@
actor: AcceptanceTester
namespace: ahnames\hipanel\tests
paths:
tests: tests
output: "%COMMON_TESTS_LOCATION%/_output"
data: tests/_data
support: tests/_support
envs: tests/_envs
extensions:
enabled:
- Codeception\Extension\RunFailed
params:
- '%PARAMS_LOCATION%'
2 changes: 2 additions & 0 deletions tests/_output/.gitignore
@@ -0,0 +1,2 @@
*
!.gitignore
26 changes: 26 additions & 0 deletions tests/_support/AcceptanceTester.php
@@ -0,0 +1,26 @@
<?php
namespace ahnames\hipanel\tests\_support;

/**
* Inherited Methods
* @method void wantToTest($text)
* @method void wantTo($text)
* @method void execute($callable)
* @method void expectTo($prediction)
* @method void expect($prediction)
* @method void amGoingTo($argumentation)
* @method void am($role)
* @method void lookForwardTo($achieveValue)
* @method void comment($description)
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
*
* @SuppressWarnings(PHPMD)
*/
class AcceptanceTester extends \Codeception\Actor
{
use _generated\AcceptanceTesterActions;

/**
* Define custom actions here
*/
}
2 changes: 2 additions & 0 deletions tests/_support/_generated/.gitignore
@@ -0,0 +1,2 @@
*
!.gitignore
9 changes: 9 additions & 0 deletions tests/acceptance.suite.yml
@@ -0,0 +1,9 @@
# Codeception Test Suite Configuration
#
# Suite for acceptance tests.
# Perform tests in browser using the WebDriver or PhpBrowser.
# If you need both WebDriver and PHPBrowser tests - create a separate suite.

actor: AcceptanceTester
namespace: ahnames\hipanel\tests\_support
extends: '%COMMON_SUITE_LOCATION%'
50 changes: 50 additions & 0 deletions tests/acceptance/module/finance/manager/CertificateCrudCest.php
@@ -0,0 +1,50 @@
<?php

namespace ahnames\hipanel\tests\acceptance\module\finance\manager;

use hipanel\helpers\Url;
use hipanel\modules\finance\tests\_support\Page\plan\Create as PlanCreatePage;
use hipanel\modules\finance\tests\_support\Page\price\certificate\Create as PriceCertificateCreate;
use hipanel\modules\finance\tests\_support\Page\price\certificate\Update as PriceCertificateUpdate;
use hipanel\tests\_support\Step\Acceptance\Manager;

class CertificateCrudCest
{
/**
* @var string
*/
private $id;

/**
* @var array
*/
private $fields;

public function ensureThatICanCreateTariffPlan(Manager $I): void
{
$this->fields = [
'name' => uniqid(),
'type' => 'Certificate tariff',
'client' => 'hipanel_test_manager@hiqdev.com',
'currency' => 'USD',
'note' => 'test note',
];
$page = new PlanCreatePage($I, $this->fields);
$this->id = $page->createPlan();
}

public function ensureThatICanAddPrices(Manager $I): void
{
$I->needPage(Url::to(['@plan/view', 'id' => $this->id]));
$I->see('No prices found');
$price = new PriceCertificateCreate($I, $this->id);
$price->addPrices('Certificate tariff');
$price->ensureThereNoSuggestions('Certificate tariff');
}

public function ensureICanUpdatePrices(Manager $I): void
{
$price = new PriceCertificateUpdate($I, $this->id);
$price->updatePrices();
}
}
50 changes: 50 additions & 0 deletions tests/acceptance/module/finance/manager/DomainCrudCest.php
@@ -0,0 +1,50 @@
<?php

namespace ahnames\hipanel\tests\acceptance\module\finance\manager;

use hipanel\helpers\Url;
use hipanel\modules\finance\tests\_support\Page\plan\Create as PlanCreatePage;
use hipanel\modules\finance\tests\_support\Page\price\domain\Create as PriceDomainCreate;
use hipanel\modules\finance\tests\_support\Page\price\certificate\Update as PriceDomainUpdate;
use hipanel\tests\_support\Step\Acceptance\Manager;

class DomainCrudCest
{
/**
* @var string
*/
private $id;

/**
* @var array
*/
private $fields;

public function ensureThatICanCreateTariffPlan(Manager $I): void
{
$this->fields = [
'name' => uniqid(),
'type' => 'Domain tariff',
'client' => 'hipanel_test_manager@hiqdev.com',
'currency' => 'USD',
'note' => 'test note',
];
$page = new PlanCreatePage($I, $this->fields);
$this->id = $page->createPlan();
}

public function ensureThatICanAddPrices(Manager $I): void
{
$I->needPage(Url::to(['@plan/view', 'id' => $this->id]));
$I->see('No prices found');
$price = new PriceDomainCreate($I, $this->id);
$price->addPrices('Default Tariff');
$price->ensureThereNoSuggestions('Default Tariff');
}

public function ensureICanUpdatePrices(Manager $I): void
{
$price = new PriceDomainUpdate($I, $this->id);
$price->updatePrices();
}
}

0 comments on commit 5c10887

Please sign in to comment.