Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: Added AddingChargesCest and updated Create #252

Merged
merged 51 commits into from
Jun 15, 2021
Merged
Show file tree
Hide file tree
Changes from 47 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
b9a8068
SalesCest
Drakorgaur May 15, 2021
d3b3a57
SalesCest
Drakorgaur May 15, 2021
b6fdf26
Update tests/acceptance/client/SalesCest.php
Drakorgaur May 17, 2021
6bec4f6
Update tests/acceptance/client/SalesCest.php
Drakorgaur May 17, 2021
f4a8709
Edited button
Drakorgaur May 18, 2021
d741f82
deleted login()
Drakorgaur May 19, 2021
1bed879
Update tests/acceptance/client/SalesCest.php
Drakorgaur May 20, 2021
8ba20ba
Added BillCopyCest and Modified Create
Drakorgaur May 28, 2021
9e5c9e1
Added AddingChargesCest and updated Create
Drakorgaur Jun 1, 2021
0e7ce16
Removed before
Drakorgaur Jun 2, 2021
f11282d
Added View, Edited Create, Update and AddingChargesCest
Drakorgaur Jun 2, 2021
5b5aef5
Update tests/acceptance/seller/AddingChargesCest.php
Drakorgaur Jun 2, 2021
401ecc3
Added Example
Drakorgaur Jun 2, 2021
4e56125
Merge branch 'master' of https://github.com/hiqdev/hipanel-module-fin…
Drakorgaur Jun 2, 2021
ecfd900
Parted method
Drakorgaur Jun 2, 2021
3ac4439
Added method grabFromCurrentUrl
Drakorgaur Jun 3, 2021
3775046
Edited BillCopyCest and Create
Drakorgaur Jun 3, 2021
39ae823
Edited AddingCharges
Drakorgaur Jun 7, 2021
944d166
Merge branch 'BillChargeEditing' of github.com:Drakorgaur/hipanel-mod…
Drakorgaur Jun 7, 2021
9e8b998
Edited BillCopyCest and Create, Update
Drakorgaur Jun 10, 2021
77354fe
Edited AddingCharges: foreach added
Drakorgaur Jun 11, 2021
71fe9de
Edited Bill, Added new file - Copy.php, Updated Create and Index
Drakorgaur Jun 11, 2021
b2438c6
Edited Create, Update, View, AddingChargesCest
Drakorgaur Jun 11, 2021
ede8af0
Deleted method
Drakorgaur Jun 11, 2021
3a2ae9f
Type-Hint added, removed method
Drakorgaur Jun 14, 2021
66a06b8
Edited BillCopyCest & Create
Drakorgaur Jun 14, 2021
d1b8602
TypeHint Edited
Drakorgaur Jun 14, 2021
5955543
Edited Create and BillCopyCest typehint
Drakorgaur Jun 14, 2021
770867a
minor
strorch Jun 14, 2021
e37e067
Edited Create and BillCopyCest
Drakorgaur Jun 14, 2021
98d2f3b
Updated Create
Drakorgaur Jun 15, 2021
0653a72
Edited BillCopyCest and Create
Drakorgaur Jun 15, 2021
55249cf
Edited Create
Drakorgaur Jun 15, 2021
6ea7e2b
Edited Copy.php
Drakorgaur Jun 15, 2021
259c37d
Added PressButtonHelper
Drakorgaur Jun 15, 2021
705b5a2
Resolved Conflict
Drakorgaur Jun 15, 2021
9ac7ef2
Resolved Conflict
Drakorgaur Jun 15, 2021
d053dbc
TypeHint
Drakorgaur Jun 15, 2021
e39aeef
Edited AddingCharge, View, Create
Drakorgaur Jun 15, 2021
9f907dd
Merge branch 'master' of https://github.com/hiqdev/hipanel-module-fin…
Drakorgaur Jun 15, 2021
83171f2
Resolved Confclict
Drakorgaur Jun 15, 2021
b63931c
Resolved confclict
Drakorgaur Jun 15, 2021
39887d8
Merge branch 'master' of github.com:Drakorgaur/hipanel-module-finance…
Drakorgaur Jun 15, 2021
a4de39d
Merge branch 'BillCopyCest' of github.com:Drakorgaur/hipanel-module-f…
Drakorgaur Jun 15, 2021
b8c53ec
Resolved View
Drakorgaur Jun 15, 2021
7c34743
Updated View
Drakorgaur Jun 15, 2021
97aae07
Deleted New lines
Drakorgaur Jun 15, 2021
813c114
View Update
Drakorgaur Jun 15, 2021
f6ec230
Edited View
Drakorgaur Jun 15, 2021
1d46753
minor
strorch Jun 15, 2021
da82228
minor
strorch Jun 15, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions tests/_support/Page/bill/Update.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

namespace hipanel\modules\finance\tests\_support\Page\bill;

use hipanel\helpers\Url;

class Update extends Create
{
/**
Expand All @@ -24,4 +26,9 @@ public function seeActionSuccess(): ?string

return null;
}

public function openBillUpdateById(string $billId): void
{
$this->tester->needPage(Url::to("@bill/update?id=$billId"));
}
}
38 changes: 38 additions & 0 deletions tests/_support/Page/bill/View.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php
/**
* Finance module for HiPanel
*
* @link https://github.com/hiqdev/hipanel-module-finance
* @package hipanel-module-finance
* @license BSD-3-Clause
* @copyright Copyright (c) 2015-2021, HiQDev (http://hiqdev.com/)
*/

namespace hipanel\modules\finance\tests\_support\Page\bill;

use hipanel\tests\_support\Page\IndexPage;
use hipanel\helpers\Url;

class View extends Create
Drakorgaur marked this conversation as resolved.
Show resolved Hide resolved
{
public function viewBillById(string $billId): void
{
$this->tester->needPage(Url::to("@bill/view?id=$billId"));
}

public function ensureBillViewContainsData(array $billData): void
{
$I = $this->tester;

$indexPage = new IndexPage($I);
Drakorgaur marked this conversation as resolved.
Show resolved Hide resolved
$indexPage->gridView->BillViewContainsData($billData);
Drakorgaur marked this conversation as resolved.
Show resolved Hide resolved
}

public function ensureChargeViewContainsData(array $chargeData): void
Drakorgaur marked this conversation as resolved.
Show resolved Hide resolved
strorch marked this conversation as resolved.
Show resolved Hide resolved
{
$I = $this->tester;

$indexPage = new IndexPage($I);
$indexPage->gridView->ChargeViewContainsData($billData);
Drakorgaur marked this conversation as resolved.
Show resolved Hide resolved
}
}
86 changes: 86 additions & 0 deletions tests/acceptance/seller/AddingChargesCest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<?php

namespace hipanel\modules\finance\tests\acceptance\seller;

use hipanel\helpers\Url;
use hipanel\modules\finance\tests\_support\Page\bill\Create;
use hipanel\modules\finance\tests\_support\Page\bill\Update;
use hipanel\modules\finance\tests\_support\Page\bill\View;
use hipanel\tests\_support\Page\IndexPage;
use hipanel\tests\_support\Step\Acceptance\Seller;
use Codeception\Example;

class AddingChargesCest
{
/**
* @dataProvider provideBillData
*/
public function ensureBillWillBeEditedWithNewChargesCorrectly(Seller $I, Example $example): void
{
$I->login();
$createPage = new Create($I);
$updatePage = new Update($I);
$viewPage = new View($I);
$exampleArray = iterator_to_array($example->getIterator());
$I->needPage(Url::to('@bill/create'));

$createPage->fillMainBillFields($exampleArray);
$I->pressButton('Save');
$billId = $createPage->seeActionSuccess();

Drakorgaur marked this conversation as resolved.
Show resolved Hide resolved
$updatePage->openBillUpdateById($billId);
$createPage->addCharges($exampleArray['charges']);
$viewData = $this->getDataForViewCheck($exampleArray['charges']);
$I->click('Save');

$viewPage->viewBillById($billId);
foreach ($viewData as $key => $charge) {
$viewPage->ensureChargeViewContainsData($charge);
}
}

private function getDataForViewCheck(array $chargeData): array
{
foreach ($chargeData as $key => $billData) {
$viewData[] = array_intersect_key($chargeData, array_flip(['objectId', 'type', 'sum']));
}

return $viewData;
}

private function provideBillData(): array
{
return [
'client' => [
'login' => 'hipanel_test_user',
'type' => 'Monthly fee',
'currency' => '$',
'sum' => 250,
'quantity' => 1,
'charges' => [
'charge1' => [
'class' => 'Client',
'objectId' => 'hipanel_test_user',
'type' => 'Cash',
'sum' => 250,
'quantity' => 1,
],
'charge2' => [
'class' => 'Client',
'objectId' => 'hipanel_test_user1',
'type' => 'Intercept fee',
'sum' => 350,
'quantity' => 1,
],
'charge3' => [
'class' => 'Client',
'objectId' => 'hipanel_test_user2',
'type' => 'VAT',
'sum' => 450,
'quantity' => 1,
],
],
],
];
}
}