1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 20:22:42 +01:00

Fixes for incomplete tests

This commit is contained in:
David Bomba 2023-01-23 12:23:05 +11:00
parent 3312e7ce12
commit 527b81768a
3 changed files with 18 additions and 4 deletions

View File

@ -47,7 +47,7 @@ class EntityPolicy
public function edit(User $user, $entity) : bool
{
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->owns($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
{
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->owns($entity) && $entity->company_id == $user->companyId())
|| ($user->assigned($entity) && $entity->company_id == $user->companyId());

View File

@ -18,6 +18,7 @@ use App\Models\BankIntegration;
use App\Models\BankTransaction;
use App\Models\BankTransactionRule;
use App\Models\Invoice;
use App\Services\Bank\ProcessBankRules;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Validation\ValidationException;
use Tests\MockAccountData;
@ -41,6 +42,19 @@ class BankTransactionRuleTest extends TestCase
$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()
{
$data = [

View File

@ -31,7 +31,7 @@ class ExampleIntegrationTest extends TestCase
public function testExample()
{
$this->markTestIncomplete();
// $this->markTestIncomplete();
$invoice = $this->invoice;
$invitation = $invoice->invitations()->first();
@ -61,6 +61,6 @@ class ExampleIntegrationTest extends TestCase
// nlog($maker->getCompiledHTML(true));
$this->assertTrue(true);
$this->assertNotNull($maker->getCompiledHTML(true));
}
}