diff --git a/app/Policies/EntityPolicy.php b/app/Policies/EntityPolicy.php index 99ca027916e3..ac5155c7c97c 100644 --- a/app/Policies/EntityPolicy.php +++ b/app/Policies/EntityPolicy.php @@ -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()); diff --git a/tests/Feature/Bank/BankTransactionRuleTest.php b/tests/Feature/Bank/BankTransactionRuleTest.php index 299c693998f4..7ee479dd8544 100644 --- a/tests/Feature/Bank/BankTransactionRuleTest.php +++ b/tests/Feature/Bank/BankTransactionRuleTest.php @@ -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 = [ diff --git a/tests/Feature/PdfMaker/ExampleIntegrationTest.php b/tests/Feature/PdfMaker/ExampleIntegrationTest.php index 2c6f2061d5c2..3337550e1442 100644 --- a/tests/Feature/PdfMaker/ExampleIntegrationTest.php +++ b/tests/Feature/PdfMaker/ExampleIntegrationTest.php @@ -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)); } }