1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 07:02:34 +01:00
invoiceninja/tests/acceptance/CreditCest.php

45 lines
1.2 KiB
PHP
Raw Normal View History

2015-08-20 17:09:04 +02:00
<?php
use App\Models\Credit;
use Faker\Factory;
use Codeception\Util\Fixtures;
class CreditCest
{
private $faker;
public function _before(AcceptanceTester $I)
{
$I->checkIfLogin($I);
$this->faker = Factory::create();
}
public function create(AcceptanceTester $I)
{
$note = $this->faker->catchPhrase;
2015-09-01 20:40:30 +02:00
$clientEmail = $this->faker->safeEmail;
2015-08-20 17:09:04 +02:00
$I->wantTo('Create a credit');
2015-09-01 20:40:30 +02:00
$I->amOnPage('/clients/create');
2015-10-28 20:22:07 +01:00
$I->fillField(['name' => 'contacts[0][email]'], $clientEmail);
2015-09-01 20:40:30 +02:00
$I->click('Save');
$I->see($clientEmail);
$I->amOnPage('/credits/create');
$I->selectDropdown($I, $clientEmail, '.client-select .dropdown-toggle');
2015-08-20 17:09:04 +02:00
$I->fillField(['name' => 'amount'], rand(50, 200));
$I->fillField(['name' => 'private_notes'], $note);
$I->selectDataPicker($I, '#credit_date', 'now + 1 day');
$I->click('Save');
$I->see('Successfully created credit');
$I->seeInDatabase('credits', array('private_notes' => $note));
$I->amOnPage('/credits');
$I->seeCurrentUrlEquals('/credits');
2015-09-01 20:40:30 +02:00
$I->see($clientEmail);
2015-08-20 17:09:04 +02:00
}
}