mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Working on adding check-data to Travis
This commit is contained in:
parent
94791a6c33
commit
59b26e53ac
@ -67,7 +67,7 @@ before_script:
|
|||||||
- sleep 5
|
- sleep 5
|
||||||
# Make sure the app is up-to-date
|
# Make sure the app is up-to-date
|
||||||
- curl -L http://ninja.dev:8000/update
|
- curl -L http://ninja.dev:8000/update
|
||||||
#- php artisan ninja:create-test-data 25
|
- php artisan ninja:create-test-data 10 true
|
||||||
|
|
||||||
script:
|
script:
|
||||||
#- php ./vendor/codeception/codeception/codecept run --debug acceptance APICest.php
|
#- php ./vendor/codeception/codeception/codecept run --debug acceptance APICest.php
|
||||||
@ -91,6 +91,7 @@ after_script:
|
|||||||
- php artisan ninja:check-data --no-interaction
|
- php artisan ninja:check-data --no-interaction
|
||||||
- cat .env
|
- cat .env
|
||||||
- mysql -u root -e 'select * from accounts;' ninja
|
- mysql -u root -e 'select * from accounts;' ninja
|
||||||
|
- mysql -u root -e 'select * from users;' ninja
|
||||||
- mysql -u root -e 'select * from account_gateways;' ninja
|
- mysql -u root -e 'select * from account_gateways;' ninja
|
||||||
- mysql -u root -e 'select * from clients;' ninja
|
- mysql -u root -e 'select * from clients;' ninja
|
||||||
- mysql -u root -e 'select * from invoices;' ninja
|
- mysql -u root -e 'select * from invoices;' ninja
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Console\Commands;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use App\Ninja\Repositories\AccountRepository;
|
||||||
use App\Ninja\Repositories\ClientRepository;
|
use App\Ninja\Repositories\ClientRepository;
|
||||||
use App\Ninja\Repositories\ExpenseRepository;
|
use App\Ninja\Repositories\ExpenseRepository;
|
||||||
use App\Ninja\Repositories\InvoiceRepository;
|
use App\Ninja\Repositories\InvoiceRepository;
|
||||||
@ -25,7 +26,7 @@ class CreateTestData extends Command
|
|||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $signature = 'ninja:create-test-data {count=1}';
|
protected $signature = 'ninja:create-test-data {count=1} {create_account=false}';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var
|
* @var
|
||||||
@ -40,13 +41,15 @@ class CreateTestData extends Command
|
|||||||
* @param PaymentRepository $paymentRepo
|
* @param PaymentRepository $paymentRepo
|
||||||
* @param VendorRepository $vendorRepo
|
* @param VendorRepository $vendorRepo
|
||||||
* @param ExpenseRepository $expenseRepo
|
* @param ExpenseRepository $expenseRepo
|
||||||
|
* @param AccountRepository $accountRepo
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
ClientRepository $clientRepo,
|
ClientRepository $clientRepo,
|
||||||
InvoiceRepository $invoiceRepo,
|
InvoiceRepository $invoiceRepo,
|
||||||
PaymentRepository $paymentRepo,
|
PaymentRepository $paymentRepo,
|
||||||
VendorRepository $vendorRepo,
|
VendorRepository $vendorRepo,
|
||||||
ExpenseRepository $expenseRepo)
|
ExpenseRepository $expenseRepo,
|
||||||
|
AccountRepository $accountRepo)
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
@ -57,6 +60,7 @@ class CreateTestData extends Command
|
|||||||
$this->paymentRepo = $paymentRepo;
|
$this->paymentRepo = $paymentRepo;
|
||||||
$this->vendorRepo = $vendorRepo;
|
$this->vendorRepo = $vendorRepo;
|
||||||
$this->expenseRepo = $expenseRepo;
|
$this->expenseRepo = $expenseRepo;
|
||||||
|
$this->accountRepo = $accountRepo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -69,10 +73,21 @@ class CreateTestData extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->info(date('Y-m-d').' Running CreateTestData...');
|
$this->info(date('Y-m-d').' Running CreateTestData...');
|
||||||
|
|
||||||
Auth::loginUsingId(1);
|
|
||||||
$this->count = $this->argument('count');
|
$this->count = $this->argument('count');
|
||||||
|
|
||||||
|
if (filter_var($this->argument('create_account'), FILTER_VALIDATE_BOOLEAN)) {
|
||||||
|
$this->info('Creating new account...');
|
||||||
|
$account = $this->accountRepo->create(
|
||||||
|
$this->faker->firstName,
|
||||||
|
$this->faker->lastName,
|
||||||
|
$this->faker->safeEmail
|
||||||
|
);
|
||||||
|
Auth::login($account->users[0]);
|
||||||
|
} else {
|
||||||
|
$this->info('Using first account...');
|
||||||
|
Auth::loginUsingId(1);
|
||||||
|
}
|
||||||
|
|
||||||
$this->createClients();
|
$this->createClients();
|
||||||
$this->createVendors();
|
$this->createVendors();
|
||||||
|
|
||||||
@ -182,7 +197,7 @@ class CreateTestData extends Command
|
|||||||
'vendor_id' => $vendor->id,
|
'vendor_id' => $vendor->id,
|
||||||
'amount' => $this->faker->randomFloat(2, 1, 10),
|
'amount' => $this->faker->randomFloat(2, 1, 10),
|
||||||
'expense_date' => null,
|
'expense_date' => null,
|
||||||
'public_notes' => null,
|
'public_notes' => '',
|
||||||
];
|
];
|
||||||
|
|
||||||
$expense = $this->expenseRepo->save($data);
|
$expense = $this->expenseRepo->save($data);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user