mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes for incomplete tests
This commit is contained in:
parent
3312e7ce12
commit
527b81768a
@ -47,7 +47,7 @@ class EntityPolicy
|
|||||||
public function edit(User $user, $entity) : bool
|
public function edit(User $user, $entity) : bool
|
||||||
{
|
{
|
||||||
return ($user->isAdmin() && $entity->company_id == $user->companyId())
|
return ($user->isAdmin() && $entity->company_id == $user->companyId())
|
||||||
|| ($user->hasPermission('edit_'.strtolower(\Illuminate\Support\Str::snake(class_basename($entity)))) && $entity->company_id == $user->companyId())
|
|| ($user->hasPermission('edit_'.\Illuminate\Support\Str::snake(class_basename($entity))) && $entity->company_id == $user->companyId())
|
||||||
|| ($user->hasPermission('edit_all') && $entity->company_id == $user->companyId())
|
|| ($user->hasPermission('edit_all') && $entity->company_id == $user->companyId())
|
||||||
|| ($user->owns($entity) && $entity->company_id == $user->companyId())
|
|| ($user->owns($entity) && $entity->company_id == $user->companyId())
|
||||||
|| ($user->assigned($entity) && $entity->company_id == $user->companyId());
|
|| ($user->assigned($entity) && $entity->company_id == $user->companyId());
|
||||||
@ -64,7 +64,7 @@ class EntityPolicy
|
|||||||
public function view(User $user, $entity) : bool
|
public function view(User $user, $entity) : bool
|
||||||
{
|
{
|
||||||
return ($user->isAdmin() && $entity->company_id == $user->companyId())
|
return ($user->isAdmin() && $entity->company_id == $user->companyId())
|
||||||
|| ($user->hasPermission('view_'.strtolower(\Illuminate\Support\Str::snake(class_basename($entity)))) && $entity->company_id == $user->companyId())
|
|| ($user->hasPermission('view_'.\Illuminate\Support\Str::snake(class_basename($entity))) && $entity->company_id == $user->companyId())
|
||||||
|| ($user->hasPermission('view_all') && $entity->company_id == $user->companyId())
|
|| ($user->hasPermission('view_all') && $entity->company_id == $user->companyId())
|
||||||
|| ($user->owns($entity) && $entity->company_id == $user->companyId())
|
|| ($user->owns($entity) && $entity->company_id == $user->companyId())
|
||||||
|| ($user->assigned($entity) && $entity->company_id == $user->companyId());
|
|| ($user->assigned($entity) && $entity->company_id == $user->companyId());
|
||||||
|
@ -18,6 +18,7 @@ use App\Models\BankIntegration;
|
|||||||
use App\Models\BankTransaction;
|
use App\Models\BankTransaction;
|
||||||
use App\Models\BankTransactionRule;
|
use App\Models\BankTransactionRule;
|
||||||
use App\Models\Invoice;
|
use App\Models\Invoice;
|
||||||
|
use App\Services\Bank\ProcessBankRules;
|
||||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||||
use Illuminate\Validation\ValidationException;
|
use Illuminate\Validation\ValidationException;
|
||||||
use Tests\MockAccountData;
|
use Tests\MockAccountData;
|
||||||
@ -41,6 +42,19 @@ class BankTransactionRuleTest extends TestCase
|
|||||||
$this->withoutExceptionHandling();
|
$this->withoutExceptionHandling();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testMatchingWithStripos()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
$bt_value = strtolower(str_replace(" ", "", 'hello soldier'));
|
||||||
|
$rule_value = strtolower(str_replace(" ", "", 'solider'));
|
||||||
|
$rule_length = iconv_strlen($rule_value);
|
||||||
|
|
||||||
|
$this->assertFalse(stripos($rule_value, $bt_value) !== false);
|
||||||
|
$this->assertFalse(stripos($bt_value, $rule_value) !== false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public function testBankRuleBulkActions()
|
public function testBankRuleBulkActions()
|
||||||
{
|
{
|
||||||
$data = [
|
$data = [
|
||||||
|
@ -31,7 +31,7 @@ class ExampleIntegrationTest extends TestCase
|
|||||||
|
|
||||||
public function testExample()
|
public function testExample()
|
||||||
{
|
{
|
||||||
$this->markTestIncomplete();
|
// $this->markTestIncomplete();
|
||||||
|
|
||||||
$invoice = $this->invoice;
|
$invoice = $this->invoice;
|
||||||
$invitation = $invoice->invitations()->first();
|
$invitation = $invoice->invitations()->first();
|
||||||
@ -61,6 +61,6 @@ class ExampleIntegrationTest extends TestCase
|
|||||||
|
|
||||||
// nlog($maker->getCompiledHTML(true));
|
// nlog($maker->getCompiledHTML(true));
|
||||||
|
|
||||||
$this->assertTrue(true);
|
$this->assertNotNull($maker->getCompiledHTML(true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user