refactor: replace custom CRM with Monica fork
Some checks failed
Build & Push Monica Image to Gitea Registry / build-and-push (push) Failing after 9s

This commit is contained in:
Kroonk
2026-05-22 16:19:55 +02:00
parent 38cc4c09ca
commit a213a1dba0
2215 changed files with 242567 additions and 6015 deletions

78
tests/TestCase.php Normal file
View File

@@ -0,0 +1,78 @@
<?php
namespace Tests;
use Illuminate\Testing\TestResponse;
use Tests\Traits\CreatesApplication;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
abstract class TestCase extends BaseTestCase
{
use CreatesApplication;
/**
* Call protected/private method of a class.
*
* @param object &$object
* @param string $methodName
* @param array $parameters
* @return mixed
*/
public function invokePrivateMethod(&$object, $methodName, array $parameters = [])
{
$reflection = new \ReflectionClass(get_class($object));
$method = $reflection->getMethod($methodName);
$method->setAccessible(true);
return $method->invokeArgs($object, $parameters);
}
/**
* Set protected/private property of a class.
*
* @param object &$object
* @param string $propertyName
* @param mixed $value
* @return void
*/
public function setPrivateValue(&$object, string $propertyName, $value)
{
$reflection = new \ReflectionClass(get_class($object));
$property = $reflection->getProperty($propertyName);
$property->setAccessible(true);
$property->setValue($object, $value);
}
/**
* Get protected/private property of a class.
*
* @param object &$object
* @param string $propertyName
* @return mixed
*/
public function getPrivateValue(&$object, string $propertyName)
{
$reflection = new \ReflectionClass(get_class($object));
$property = $reflection->getProperty($propertyName);
$property->setAccessible(true);
return $property->getValue($object);
}
/**
* Test that the response contains an ObjectDeleted response.
*
* @param TestResponse $response
* @param int $id
*/
public function expectObjectDeleted(TestResponse $response, int $id)
{
$response->assertStatus(200);
$response->assertJson([
'deleted' => true,
'id' => $id,
]);
}
}