1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-09 20:52:56 +01:00

Enable auto renewing and updated Travis config

This commit is contained in:
Hillel Coren 2016-02-22 21:23:15 +02:00
parent 2af155cdee
commit 826d1b868b
10 changed files with 276 additions and 103 deletions

View File

@ -54,26 +54,26 @@ before_script:
- php artisan db:seed --no-interaction # default seed
- php artisan db:seed --no-interaction --class=UserTableSeeder # development seed
# Start webserver on ninja.dev:8000
- php artisan serve --host=ninja.dev --port=8000 & # '&' allows to run in background
- php artisan serve --host=ninja.dev & # '&' allows to run in background
# Start PhantomJS
- phantomjs --webdriver=4444 & # '&' allows to run in background
# Give it some time to start
- sleep 5
# Make sure the app is up-to-date
- curl -L http://ninja.dev:8000/update
- curl -L http://ninja.dev/update
script:
- php ./vendor/codeception/codeception/codecept run --debug acceptance AllPagesCept.php
- php ./vendor/codeception/codeception/codecept run --debug acceptance APICest.php
- php ./vendor/codeception/codeception/codecept run --debug acceptance CheckBalanceCest.php
- php ./vendor/codeception/codeception/codecept run --debug acceptance ClientCest.php
- php ./vendor/codeception/codeception/codecept run --debug acceptance CreditCest.php
- php ./vendor/codeception/codeception/codecept run --debug acceptance InvoiceCest.php
- php ./vendor/codeception/codeception/codecept run --debug acceptance InvoiceDesignCest.php
- php ./vendor/codeception/codeception/codecept run acceptance OnlinePaymentCest.php
- php ./vendor/codeception/codeception/codecept run --debug acceptance PaymentCest.php
- php ./vendor/codeception/codeception/codecept run --debug acceptance TaskCest.php
- php ./vendor/codeception/codeception/codecept run --debug acceptance TaxRatesCest.php
#- php ./vendor/codeception/codeception/codecept run --debug acceptance APICest.php
#- php ./vendor/codeception/codeception/codecept run --debug acceptance CheckBalanceCest.php
#- php ./vendor/codeception/codeception/codecept run --debug acceptance ClientCest.php
#- php ./vendor/codeception/codeception/codecept run --debug acceptance CreditCest.php
#- php ./vendor/codeception/codeception/codecept run --debug acceptance InvoiceCest.php
#- php ./vendor/codeception/codeception/codecept run --debug acceptance InvoiceDesignCest.php
#- php ./vendor/codeception/codeception/codecept run acceptance OnlinePaymentCest.php
#- php ./vendor/codeception/codeception/codecept run --debug acceptance PaymentCest.php
#- php ./vendor/codeception/codeception/codecept run --debug acceptance TaskCest.php
#- php ./vendor/codeception/codeception/codecept run --debug acceptance TaxRatesCest.php
#- sed -i 's/NINJA_DEV=true/NINJA_PROD=true/g' .env
#- php ./vendor/codeception/codeception/codecept run acceptance GoProCest.php

View File

@ -47,7 +47,7 @@ class SendRenewalInvoices extends Command
}
$client = $this->accountRepo->getNinjaClient($account);
$invitation = $this->accountRepo->createNinjaInvoice($client);
$invitation = $this->accountRepo->createNinjaInvoice($client, $account);
// set the due date to 10 days from now
$invoice = $invitation->invoice;

View File

@ -16,6 +16,7 @@ class Kernel extends ConsoleKernel
'App\Console\Commands\ResetData',
'App\Console\Commands\CheckData',
'App\Console\Commands\SendRenewalInvoices',
'App\Console\Commands\ChargeRenewalInvoices',
'App\Console\Commands\SendReminders',
'App\Console\Commands\TestOFX',
'App\Console\Commands\GenerateResources',

View File

@ -72,7 +72,7 @@ class Utils
public static function requireHTTPS()
{
if (Request::root() === 'http://ninja.dev:8000') {
if (Request::root() === 'http://ninja.dev') {
return false;
}

View File

@ -24,29 +24,49 @@ class SubscriptionListener
{
public function createdClient(ClientWasCreated $event)
{
if ( ! Auth::check()) {
return;
}
$transformer = new ClientTransformer(Auth::user()->account);
$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_CLIENT, $event->client, $transformer);
}
public function createdQuote(QuoteWasCreated $event)
{
if ( ! Auth::check()) {
return;
}
$transformer = new InvoiceTransformer(Auth::user()->account);
$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_QUOTE, $event->quote, $transformer, ENTITY_CLIENT);
}
public function createdPayment(PaymentWasCreated $event)
{
if ( ! Auth::check()) {
return;
}
$transformer = new PaymentTransformer(Auth::user()->account);
$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_PAYMENT, $event->payment, $transformer, [ENTITY_CLIENT, ENTITY_INVOICE]);
}
public function createdCredit(CreditWasCreated $event)
{
if ( ! Auth::check()) {
return;
}
//$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_CREDIT, $event->credit);
}
public function createdInvoice(InvoiceWasCreated $event)
{
if ( ! Auth::check()) {
return;
}
$transformer = new InvoiceTransformer(Auth::user()->account);
$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_INVOICE, $event->invoice, $transformer, ENTITY_CLIENT);
}

View File

@ -124,13 +124,14 @@ class AccountRepository
return false;
}
$client = $this->getNinjaClient(Auth::user()->account);
$invitation = $this->createNinjaInvoice($client);
$account = Auth::user()->account;
$client = $this->getNinjaClient($account);
$invitation = $this->createNinjaInvoice($client, $account);
return $invitation;
}
public function createNinjaInvoice($client)
public function createNinjaInvoice($client, $account)
{
$account = $this->getNinjaAccount();
$lastInvoice = Invoice::withTrashed()->whereAccountId($account->id)->orderBy('public_id', 'DESC')->first();
@ -142,7 +143,7 @@ class AccountRepository
$invoice->public_id = $publicId;
$invoice->client_id = $client->id;
$invoice->invoice_number = $account->getNextInvoiceNumber($invoice);
$invoice->invoice_date = Auth::user()->account->getRenewalDate();
$invoice->invoice_date = $account->getRenewalDate();
$invoice->amount = PRO_PLAN_PRICE;
$invoice->balance = PRO_PLAN_PRICE;
$invoice->save();

View File

@ -2,7 +2,7 @@
// This is global bootstrap for autoloading
use Codeception\Util\Fixtures;
Fixtures::add('url', 'http://ninja.dev:8000');
Fixtures::add('url', 'http://ninja.dev');
Fixtures::add('username', 'user@example.com');
Fixtures::add('password', 'password');

View File

@ -1,4 +1,4 @@
<?php //[STAMP] fd572cb1f679911978b9f48a842ed64b
<?php //[STAMP] 5d3610ae822b6990504d5dce501c103b
namespace _generated;
// This class was automatically generated by build task
@ -17,6 +17,17 @@ trait AcceptanceTesterActions
abstract protected function getScenario();
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Print out latest Selenium Logs in debug mode
* @see \Codeception\Module\WebDriver::debugWebDriverLogs()
*/
public function debugWebDriverLogs() {
return $this->getScenario()->runStep(new \Codeception\Step\Action('debugWebDriverLogs', func_get_args()));
}
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
@ -166,7 +177,7 @@ trait AcceptanceTesterActions
* [!] Method is generated. Documentation taken from corresponding module.
*
* Sets a cookie with the given name and value.
* You can set additional cookie params like `domain`, `path`, `expire`, `secure` in array passed as last argument.
* You can set additional cookie params like `domain`, `path`, `expires`, `secure` in array passed as last argument.
*
* ``` php
* <?php
@ -249,7 +260,6 @@ trait AcceptanceTesterActions
* $I->amOnPage('/');
* // opens /register page
* $I->amOnPage('/register');
* ?>
* ```
*
* @param $page
@ -263,16 +273,31 @@ trait AcceptanceTesterActions
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that the current page contains the given string.
* Specify a locator as the second parameter to match a specific region.
* Checks that the current page contains the given string (case insensitive).
*
* You can specify a specific HTML element (via CSS or XPath) as the second
* parameter to only search within that element.
*
* ``` php
* <?php
* $I->see('Logout'); // I can suppose user is logged in
* $I->see('Sign Up','h1'); // I can suppose it's a signup page
* $I->see('Sign Up','//body/h1'); // with XPath
* ?>
* $I->see('Logout'); // I can suppose user is logged in
* $I->see('Sign Up', 'h1'); // I can suppose it's a signup page
* $I->see('Sign Up', '//body/h1'); // with XPath
* ```
*
* Note that the search is done after stripping all HTML tags from the body,
* so `$I->see('strong')` will return true for strings like:
*
* - `<p>I am Stronger than thou</p>`
* - `<script>document.createElement('strong');</script>`
*
* But will *not* be true for strings like:
*
* - `<strong>Home</strong>`
* - `<div class="strong">Home</strong>`
* - `<!-- strong -->`
*
* For checking the raw source code, use `seeInSource()`.
*
* @param $text
* @param null $selector
@ -285,16 +310,31 @@ trait AcceptanceTesterActions
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that the current page contains the given string.
* Specify a locator as the second parameter to match a specific region.
* Checks that the current page contains the given string (case insensitive).
*
* You can specify a specific HTML element (via CSS or XPath) as the second
* parameter to only search within that element.
*
* ``` php
* <?php
* $I->see('Logout'); // I can suppose user is logged in
* $I->see('Sign Up','h1'); // I can suppose it's a signup page
* $I->see('Sign Up','//body/h1'); // with XPath
* ?>
* $I->see('Logout'); // I can suppose user is logged in
* $I->see('Sign Up', 'h1'); // I can suppose it's a signup page
* $I->see('Sign Up', '//body/h1'); // with XPath
* ```
*
* Note that the search is done after stripping all HTML tags from the body,
* so `$I->see('strong')` will return true for strings like:
*
* - `<p>I am Stronger than thou</p>`
* - `<script>document.createElement('strong');</script>`
*
* But will *not* be true for strings like:
*
* - `<strong>Home</strong>`
* - `<div class="strong">Home</strong>`
* - `<!-- strong -->`
*
* For checking the raw source code, use `seeInSource()`.
*
* @param $text
* @param null $selector
@ -308,16 +348,29 @@ trait AcceptanceTesterActions
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that the current page doesn't contain the text specified.
* Checks that the current page doesn't contain the text specified (case insensitive).
* Give a locator as the second parameter to match a specific region.
*
* ```php
* <?php
* $I->dontSee('Login'); // I can suppose user is already logged in
* $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page
* $I->dontSee('Sign Up','//body/h1'); // with XPath
* ?>
* $I->dontSee('Login'); // I can suppose user is already logged in
* $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page
* $I->dontSee('Sign Up','//body/h1'); // with XPath
* ```
*
* Note that the search is done after stripping all HTML tags from the body,
* so `$I->dontSee('strong')` will fail on strings like:
*
* - `<p>I am Stronger than thou</p>`
* - `<script>document.createElement('strong');</script>`
*
* But will ignore strings like:
*
* - `<strong>Home</strong>`
* - `<div class="strong">Home</strong>`
* - `<!-- strong -->`
*
* For checking the raw source code, use `seeInSource()`.
*
* @param $text
* @param null $selector
@ -330,16 +383,29 @@ trait AcceptanceTesterActions
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that the current page doesn't contain the text specified.
* Checks that the current page doesn't contain the text specified (case insensitive).
* Give a locator as the second parameter to match a specific region.
*
* ```php
* <?php
* $I->dontSee('Login'); // I can suppose user is already logged in
* $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page
* $I->dontSee('Sign Up','//body/h1'); // with XPath
* ?>
* $I->dontSee('Login'); // I can suppose user is already logged in
* $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page
* $I->dontSee('Sign Up','//body/h1'); // with XPath
* ```
*
* Note that the search is done after stripping all HTML tags from the body,
* so `$I->dontSee('strong')` will fail on strings like:
*
* - `<p>I am Stronger than thou</p>`
* - `<script>document.createElement('strong');</script>`
*
* But will ignore strings like:
*
* - `<strong>Home</strong>`
* - `<div class="strong">Home</strong>`
* - `<!-- strong -->`
*
* For checking the raw source code, use `seeInSource()`.
*
* @param $text
* @param null $selector
@ -350,6 +416,80 @@ trait AcceptanceTesterActions
}
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that the current page contains the given string in its
* raw source code.
*
* ``` php
* <?php
* $I->seeInSource('<h1>Green eggs &amp; ham</h1>');
* ```
*
* @param $raw
* Conditional Assertion: Test won't be stopped on fail
* @see \Codeception\Module\WebDriver::seeInSource()
*/
public function canSeeInSource($raw) {
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInSource', func_get_args()));
}
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that the current page contains the given string in its
* raw source code.
*
* ``` php
* <?php
* $I->seeInSource('<h1>Green eggs &amp; ham</h1>');
* ```
*
* @param $raw
* @see \Codeception\Module\WebDriver::seeInSource()
*/
public function seeInSource($raw) {
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInSource', func_get_args()));
}
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that the current page contains the given string in its
* raw source code.
*
* ```php
* <?php
* $I->dontSeeInSource('<h1>Green eggs &amp; ham</h1>');
* ```
*
* @param $raw
* Conditional Assertion: Test won't be stopped on fail
* @see \Codeception\Module\WebDriver::dontSeeInSource()
*/
public function cantSeeInSource($raw) {
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInSource', func_get_args()));
}
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that the current page contains the given string in its
* raw source code.
*
* ```php
* <?php
* $I->dontSeeInSource('<h1>Green eggs &amp; ham</h1>');
* ```
*
* @param $raw
* @see \Codeception\Module\WebDriver::dontSeeInSource()
*/
public function dontSeeInSource($raw) {
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInSource', func_get_args()));
}
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
@ -790,7 +930,6 @@ trait AcceptanceTesterActions
*
* @param null $uri
*
* @internal param $url
* @return mixed
* @see \Codeception\Module\WebDriver::grabFromCurrentUrl()
*/
@ -1388,7 +1527,7 @@ trait AcceptanceTesterActions
*
* @param $cssOrXpath
* @param $attribute
* @internal param $element
*
* @return mixed
* @see \Codeception\Module\WebDriver::grabAttributeFrom()
*/
@ -1425,7 +1564,28 @@ trait AcceptanceTesterActions
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
*
* Grabs either the text content, or attribute values, of nodes
* matched by $cssOrXpath and returns them as an array.
*
* ```html
* <a href="#first">First</a>
* <a href="#second">Second</a>
* <a href="#third">Third</a>
* ```
*
* ```php
* <?php
* // would return ['First', 'Second', 'Third']
* $aLinkText = $I->grabMultiple('a');
*
* // would return ['#first', '#second', '#third']
* $aLinks = $I->grabMultiple('a', 'href');
* ?>
* ```
*
* @param $cssOrXpath
* @param $attribute
* @return string[]
* @see \Codeception\Module\WebDriver::grabMultiple()
*/
public function grabMultiple($cssOrXpath, $attribute = null) {
@ -1640,6 +1800,27 @@ trait AcceptanceTesterActions
}
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
*
* Conditional Assertion: Test won't be stopped on fail
* @see \Codeception\Module\WebDriver::seeNumberOfElementsInDOM()
*/
public function canSeeNumberOfElementsInDOM($selector, $expected) {
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeNumberOfElementsInDOM', func_get_args()));
}
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
*
* @see \Codeception\Module\WebDriver::seeNumberOfElementsInDOM()
*/
public function seeNumberOfElementsInDOM($selector, $expected) {
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeNumberOfElementsInDOM', func_get_args()));
}
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
@ -1957,13 +2138,13 @@ trait AcceptanceTesterActions
* ```
* Note that "2" will be the submitted value for the "plan" field, as it is
* the selected option.
*
*
* Also note that this differs from PhpBrowser, in that
* ```'user' => [ 'login' => 'Davert' ]``` is not supported at the moment.
* Named array keys *must* be included in the name as above.
*
*
* Pair this with seeInFormFields for quick testing magic.
*
*
* ``` php
* <?php
* $form = [
@ -2006,20 +2187,20 @@ trait AcceptanceTesterActions
*
* Mixing string and boolean values for a checkbox's value is not supported
* and may produce unexpected results.
*
* Field names ending in "[]" must be passed without the trailing square
*
* Field names ending in "[]" must be passed without the trailing square
* bracket characters, and must contain an array for its value. This allows
* submitting multiple values with the same name, consider:
*
*
* ```php
* $I->submitForm('#my-form', [
* 'field[]' => 'value',
* 'field[]' => 'another value', // 'field[]' is already a defined key
* ]);
* ```
*
*
* The solution is to pass an array value:
*
*
* ```php
* // this way both values are submitted
* $I->submitForm('#my-form', [
@ -2179,7 +2360,7 @@ trait AcceptanceTesterActions
* If Codeception commands are not enough, this allows you to use Selenium WebDriver methods directly:
*
* ``` php
* $I->executeInSelenium(function(\Facebook\WebDriver\RemoteWebDriver $webdriver) {
* $I->executeInSelenium(function(\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) {
* $webdriver->get('http://google.com');
* });
* ```
@ -2222,7 +2403,7 @@ trait AcceptanceTesterActions
*
* ``` php
* <?php
* $I->executeInSelenium(function (\Facebook\WebDriver\RemoteWebDriver $webdriver) {
* $I->executeInSelenium(function (\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) {
* $handles=$webdriver->getWindowHandles();
* $last_window = end($handles);
* $webdriver->switchTo()->window($last_window);
@ -2463,34 +2644,7 @@ trait AcceptanceTesterActions
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Saves current cookies into named snapshot in order to restore them in other tests
* This is useful to save session state between tests.
* For example, if user needs log in to site for each test this scenario can be executed once
* while other tests can just restore saved cookies.
*
* ``` php
* <?php
* // inside AcceptanceTester class:
*
* public function login()
* {
* // if snapshot exists - skipping login
* if ($I->loadSessionSnapshot('login')) return;
*
* // logging in
* $I->amOnPage('/login');
* $I->fillField('name', 'jon');
* $I->fillField('password', '123345');
* $I->click('Login');
*
* // saving snapshot
* $I->saveSessionSnapshot('login');
* }
* ?>
* ```
*
* @param $name
* @return mixed
* @param string $name
* @see \Codeception\Module\WebDriver::saveSessionSnapshot()
*/
public function saveSessionSnapshot($name) {
@ -2501,11 +2655,8 @@ trait AcceptanceTesterActions
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Loads cookies from saved snapshot.
*
* @param $name
* @see saveSessionSnapshot
* @return mixed
* @param string $name
* @return bool
* @see \Codeception\Module\WebDriver::loadSessionSnapshot()
*/
public function loadSessionSnapshot($name) {
@ -2516,7 +2667,7 @@ trait AcceptanceTesterActions
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Inserts SQL record into database. This record will be erased after the test.
* Inserts an SQL record into a database. This record will be erased after the test.
*
* ``` php
* <?php
@ -2538,7 +2689,7 @@ trait AcceptanceTesterActions
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks if a row with given column values exists.
* Asserts that a row with the given column values exists.
* Provide table name and column values.
*
* Example:
@ -2566,7 +2717,7 @@ trait AcceptanceTesterActions
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks if a row with given column values exists.
* Asserts that a row with the given column values exists.
* Provide table name and column values.
*
* Example:
@ -2595,7 +2746,7 @@ trait AcceptanceTesterActions
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Asserts that found number of records in database
* Asserts that the given number of records were found in the database.
*
* ``` php
* <?php
@ -2603,19 +2754,19 @@ trait AcceptanceTesterActions
* ?>
* ```
*
* @param int $num Expected number
* @param int $expectedNumber Expected number
* @param string $table Table name
* @param array $criteria Search criteria [Optional]
* Conditional Assertion: Test won't be stopped on fail
* @see \Codeception\Module\Db::seeNumRecords()
*/
public function canSeeNumRecords($num, $table, $criteria = null) {
public function canSeeNumRecords($expectedNumber, $table, $criteria = null) {
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeNumRecords', func_get_args()));
}
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Asserts that found number of records in database
* Asserts that the given number of records were found in the database.
*
* ``` php
* <?php
@ -2623,12 +2774,12 @@ trait AcceptanceTesterActions
* ?>
* ```
*
* @param int $num Expected number
* @param int $expectedNumber Expected number
* @param string $table Table name
* @param array $criteria Search criteria [Optional]
* @see \Codeception\Module\Db::seeNumRecords()
*/
public function seeNumRecords($num, $table, $criteria = null) {
public function seeNumRecords($expectedNumber, $table, $criteria = null) {
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeNumRecords', func_get_args()));
}
@ -2638,7 +2789,7 @@ trait AcceptanceTesterActions
*
* Effect is opposite to ->seeInDatabase
*
* Checks if there is no record with such column values in database.
* Asserts that there is no record with the given column values in a database.
* Provide table name and column values.
*
* Example:
@ -2668,7 +2819,7 @@ trait AcceptanceTesterActions
*
* Effect is opposite to ->seeInDatabase
*
* Checks if there is no record with such column values in database.
* Asserts that there is no record with the given column values in a database.
* Provide table name and column values.
*
* Example:

View File

@ -8,7 +8,7 @@ class_name: AcceptanceTester
modules:
enabled:
- WebDriver:
url: 'http://ninja.dev:8000/'
url: 'http://ninja.dev/'
window_size: 1024x768
wait: 5
browser: firefox

View File

@ -9,7 +9,7 @@ modules:
enabled:
- \Helper\Functional
- PhpBrowser:
url: 'http://ninja.dev:8000'
url: 'http://ninja.dev'
curl:
CURLOPT_RETURNTRANSFER: true
- Laravel5: