Ejemplo n.º 1
0
<?php

$I = new AcceptanceTester($scenario);
$I->wantTo('ensure that User create work');
// ADMIN
$I->login();
$I->go(['/user/user/create']);
$I->testForm('#user-form', 'User', [], ['username' => 'admin', 'owner_id' => 'asd', 'email' => 123, 'phone' => 'DN', 'password' => '', 'notify' => 'DN', 'permissions[]' => 'uploader']);
$I->testForm('#user-form', 'User', ['username' => 'test', 'owner_id' => '1', 'email' => '*****@*****.**', 'phone' => '+79125675656', 'password' => 'admin', 'notify' => '1', 'permissions[]' => 'partner']);
$I->seeElement('.alert-success');
//CUSTOMER
$I->customerLogin();
$I->go(['/user/user/create']);
$I->testForm('#user-form', 'User', [], ['username' => 'admin', 'owner_id' => 3, 'email' => 123, 'phone' => 'DN', 'password' => '', 'notify' => 'DN', 'permissions[]' => 'root']);
$I->testForm('#user-form', 'User', ['username' => 'test1', 'owner_id' => '2', 'email' => 'test1@test1.test1', 'phone' => '+79125675656', 'password' => 'admin', 'notify' => '1', 'permissions[]' => 'partner']);
$I->seeElement('.alert-success');
Ejemplo n.º 2
0
<?php

$I = new AcceptanceTester($scenario);
$I->wantTo('ensure that Notice create works');
// ADMIN
$I->login();
$I->go(['/notice/item/create']);
// wrong data
$I->testForm('#notice-form', 'Item', [], ['owner_id' => 123, 'users[]' => 123, 'partners[]' => 123, 'message' => '', 'date_from' => '28/12/2015', 'date_to' => '2015-12-28']);
// correct data
$I->testForm('#notice-form', 'Item', ['owner_id' => 1, 'partners[]' => 2, 'users[]' => 3, 'message' => 'test message', 'date_from' => '2015-10-10', 'date_to' => '2015-10-10']);
$I->seeElement('.alert-success');
// CUSTOMER
$I->customerLogin();
$I->go(['/notice/item/create']);
// wrong data
$I->testForm('#notice-form', 'Item', ['owner_id' => 123], ['users[]' => 1, 'partners[]' => 3, 'message' => '', 'date_from' => '28/12/2015', 'date_to' => '2015-12-28']);
// correct data
$I->testForm('#notice-form', 'Item', ['partners[]' => 2, 'users[]' => 3, 'message' => 'test message', 'date_from' => '2015-10-10', 'date_to' => '2015-10-10']);
$I->seeElement('.alert-success');
Ejemplo n.º 3
0
<?php

$I = new AcceptanceTester($scenario);
$I->wantTo('ensure that Campaign create works');
// ADMIN
$I->customerLogin();
$I->go(['/campaign/item/create']);
// wrong data
$I->testForm('#campaign-form', 'Item', ['owner_id' => 123], ['partner_type' => 123, 'title' => '', 'partners[]' => 3, 'date_start' => '28/12/2015', 'date_end' => '2015-12-28', 'date_delivery' => '2015-12-30']);
// correct data
$I->testForm('#campaign-form', 'Item', ['partner_type' => 0, 'title' => 'test campaign', 'partners[]' => 2, 'date_start' => date('Y-m-d'), 'date_end' => date('Y-m-d', strtotime('+5days')), 'date_delivery' => date('Y-m-d')]);
$I->seeElement('.alert-success');
$updateUrl = $I->getUrl();
$id = preg_replace('/.*(\\d+)/', '$1', $updateUrl);
// ADDING TEMPLATE
$I->click('.template-add-link');
// I am on template select page
$I->click('template 1');
// I am on template add form
$I->testForm('form', 'Template', [], ['partners[]' => 1]);
$I->testForm('form', 'Template', ['partners[]' => 2]);
// I am on template view page
$I->go($updateUrl);
// I see added template in campaign
$I->see('template 1', 'strong');
// ADDING MATERIAL
$I->click('.material-add-button');
// I am on material add page
$I->click('.material-add-image');
// I am on material add page
$I->testForm('#material-form', 'Material', [], ['title' => '']);
// PARTNER
$I->partnerLogin();
$I->go($updateUrl);
// ADDING MATERIAL
$I->click('.material-add-button');
// I am on material add page
$I->click('.material-add-image');
// I am on material add page
// wrong data
$I->testMultipleForm('#material-form', ['Material' => ['correct' => ['owner_id' => 'asd'], 'wrong' => ['title' => '']], 'MaterialRule[new-0]' => ['correct' => ['rule_id' => 1], 'wrong' => ['operator' => '<<', 'value' => '']]]);
// correct data
$I->testMultipleForm('#material-form', ['Material' => ['correct' => ['title' => 'partner test material', 'description' => 'partner test description'], 'wrong' => []], 'MaterialRule[new-0]' => ['correct' => ['rule_id' => 1, 'operator' => '=', 'value' => 'Mercedes'], 'wrong' => []]]);
// UPDATE partner campaign
$I->go($updateUrl);
$I->seeElement('#material-view-' . \app\modules\campaign\models\Material::find()->max('id'));
$I->testForm('#partner-campaign-form', 'PartnerItem', [], ['status' => \app\modules\campaign\models\PartnerItem::STATUS_ACCEPT]);
$I->testForm('#partner-campaign-form', 'PartnerItem', ['status' => \app\modules\campaign\models\PartnerItem::STATUS_READY]);
$I->seeElement('.alert-success');
$I->go($updateUrl);
$I->seeElement('.alert-danger');
// now partner has to wait for customer to approve
// CUSTOMER
$I->customerLogin();
$I->go($updateUrl);
$I->testForm('#partner-campaign-form', 'PartnerItem', [], ['status' => \app\modules\campaign\models\PartnerItem::STATUS_NEW]);
$I->testForm('#partner-campaign-form', 'PartnerItem', ['status' => \app\modules\campaign\models\PartnerItem::STATUS_ACCEPT]);
$I->seeElement('.alert-success');
$I->go($updateUrl);
$I->seeElement('.alert-danger');
// campaign is in process
// PARTNER
Ejemplo n.º 5
0
<?php

$I = new AcceptanceTester($scenario);
$I->wantTo('ensure that Material create works');
// CUSTOMER
$I->customerLogin();
$I->go(['/material/item/create']);
// wrong data
$I->attachFile('#item-file', 'mmc.pdf');
// small dpi
$I->testForm('#item-form', 'Item', [], ['file' => 123, 'type' => 123, 'owner_id' => 3, 'valid_from' => '28/12/2015', 'valid_to' => '2015-12-28']);
// correct data
$I->attachFile('#item-file', 'material.jpg');
$I->testForm('#item-form', 'Item', ['file' => 'material.jpg', 'type' => 0, 'owner_id' => 2, 'description' => 'asdasd', 'valid_from' => date('Y-m-d'), 'valid_to' => date('Y-m-d')]);
$I->seeElement('.alert-success');
// CUSTOMER
$I->partnerLogin();
$I->go(['/material/item/create']);
// wrong data
$I->attachFile('#item-file', 'mmc.pdf');
// small dpi
$I->testForm('#item-form', 'Item', ['owner_id' => 123], ['file' => 123, 'type' => 123, 'valid_from' => '28/12/2015', 'valid_to' => '2015-12-28']);
// correct data
$I->attachFile('#item-file', 'material.jpg');
$I->testForm('#item-form', 'Item', ['file' => 'material.jpg', 'type' => 0, 'description' => 'asdasd', 'valid_from' => date('Y-m-d'), 'valid_to' => date('Y-m-d')]);
$I->seeElement('.alert-success');
// PARTNER
// no upload role
$partner = \bariew\yii2Tools\tests\FixtureManager::get('user_user', 'test_partner1');
$I->login($partner->username, 'admin');
$I->go(['/material/item/create']);
Ejemplo n.º 6
0
<?php

$I = new AcceptanceTester($scenario);
$I->wantTo('ensure that Section create works');
// ADMIN
$I->login();
$I->go(['/template/section/create']);
$I->testForm('#section-form', 'Section', [], ['title' => '', 'status' => 123, 'type' => 123, 'width' => 'asd', 'height' => 'asd', 'material_max' => 'asd', 'price' => 'asd']);
$I->testForm('#section-form', 'Section', ['title' => 'Test section', 'status' => 0, 'type' => 0, 'templates[]' => '1', 'description' => 'test descr', 'width' => 100, 'height' => 100, 'material_max' => 3, 'price' => 100, 'price_comment' => 'test comment']);
$I->seeElement('.alert-success');
Ejemplo n.º 7
0
<?php

$I = new AcceptanceTester($scenario);
$I->wantTo('ensure that Rule create works');
// ADMIN
$I->login();
$I->go(['/template/rule/index']);
// index page
$I->testForm('#rule-create-form', 'RuleSearch', ['owner_id' => 2, 'partner_type' => 1]);
$I->seeElement('.alert-danger');
$I->testForm('#rule-create-form', 'RuleSearch', ['owner_id' => 1, 'partner_type' => 0]);
// form page
// wrong data
$I->testForm('#rule-form', 'Rule', ['owner_id' => 1, 'partner_type' => 0], ['title' => '', 'form_type' => 123, 'field' => 123, 'values' => 'some wrong parsed string']);
$I->testForm('#rule-form', 'Rule', ['owner_id' => 1, 'partner_type' => 0, 'form_type' => 2], ['title' => '', 'field' => '', 'values' => '']);
// correct data
$I->testForm('#rule-form', 'Rule', ['owner_id' => 1, 'partner_type' => 0, 'title' => 'Test rule', 'form_type' => 2, 'field' => 'car_brand', 'values' => "1=option1;1\n2=option2;0", 'sections[]' => '1']);
$I->seeElement('.alert-success');
Ejemplo n.º 8
0
<?php

$I = new AcceptanceTester($scenario);
$I->wantTo('ensure that company create work');
// ADMIN
$I->login();
$I->go(['/user/company/create']);
$I->testForm('#company-form', 'Company', [], ['title' => 'EXAMPLE', 'owner_id' => 'asd', 'type' => 123, 'outer_id' => 'DN']);
$I->testForm('#company-form', 'Company', ['title' => 'new title', 'owner_id' => '1', 'type' => 0, 'outer_id' => 'AS']);
$I->seeElement('.alert-success');
//CUSTOMER
$I->customerLogin();
$I->go(['/user/company/create']);
$I->testForm('#company-form', 'Company', [], ['title' => 'EXAMPLE', 'type' => 123, 'outer_id' => 'DN']);
$I->testForm('#company-form', 'Company', ['title' => 'new title customer', 'type' => 0, 'outer_id' => 'AS1']);
$I->seeElement('.alert-success');
Ejemplo n.º 9
0
<?php

$I = new AcceptanceTester($scenario);
$I->wantTo('ensure that Template create work');
// ADMIN
$I->login();
$I->go(['/template/item/create']);
$I->testForm('#item-form', 'Item', [], ['title' => '', 'status' => 123, 'type' => 123, 'partner_type' => 123]);
$I->testForm('#item-form', 'Item', ['title' => 'test title', 'status' => 0, 'type' => 0, 'partner_type' => 0, 'customers[]' => '1', 'sections[]' => '1', 'description' => 'test descr']);
$I->seeElement('.alert-success');
Ejemplo n.º 10
0
<?php

$I = new AcceptanceTester($scenario);
$I->wantTo('ensure that SectionPreview create works');
// ADMIN
$I->login();
$I->go(['/template/section-preview/create']);
// wrong data
$I->attachFile('#sectionpreview-file', 'mmc.pdf');
$I->testForm('#preview-form', 'SectionPreview', [], ['file' => 123, 'owner_id' => 123, 'img_width' => 'asd', 'img_height' => 'sdf', 'img_top' => '', 'img_left' => '', 'section_content' => '', 'material_content' => '']);
// correct data
$I->attachFile('#sectionpreview-file', 'template_background.png');
$I->testForm('#preview-form', 'SectionPreview', ['owner_id' => 2, 'sections[]' => 1, 'img_width' => '756', 'img_height' => '410', 'img_top' => '702', 'img_left' => '19', 'section_content' => 'Section content', 'material_content' => 'Material content']);
$I->seeElement('.alert-success');