PHPUnit / phpunit (push) Canceled after 0s
* fix: upgrade goteo/benzina to 0.6 * feat: increase Nominatim cache TTL * fix: allow long addresses for territory data * fix: build project addresses from goteo 3 territory fields * fix: handle empty strings for video sources * fix: update project drafts deadline to 2026 * feat: split project description into 4 fields * feat: bump doctrine related dependencies * feat: bump symfony related dependencies * feat: make categories work on idOrSlug * fix: allow filtering on project descBrief property * fix: update constraints on project update to allow optional updates of properties * fix: update Projects test suite to new project shape * fix: order of DROP operations in migration Version20260813171902 * fix: move accounting balance and checkout to supports listeners to onFlush events * fix: bad order of filter safeguards * chore: code style by php-cs-fixer * fix: prevent uninitialized fields on api resource from breaking AccountingVoter * fix: small bug preventing code improvements on Accounting api resource * feat: add cover property on ProjectReward resource * feat: add cover property to Project resources * feat: use video cover for project cover * feat: add migration for property cover on project and rewards * fix: small improvements on UserOwned helpers * feat: add territory to project creation * feat: mark creation fields as required * feat: add CollaborationCandidacy resource * fix: update old validations access of new types * feat: add validation for charges targetting projects not in campaign * feat: validate new collaboration candicacies are to open collaborations * feat: prevent future object access issues in SameProjectRewardChargeValidator * fix: return void on succesfull delete operations * fix: force set of isFinite property * feat: allow to filter ProjectBudgetItem by type and deadline * feat: remove example values from .env * feat: add testing encryption keys * feat: make project in BudgetItem body required * feat: add testing encryption keys to actions * feat: add collaborations property to ProjectApiResource
71 lines
1.8 KiB
PHP
71 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Tests\Entity\ProjectApi;
|
|
|
|
use ApiPlatform\Symfony\Bundle\Test\ApiTestCase;
|
|
use App\Entity\Territory;
|
|
use App\Factory\CategoryFactory;
|
|
use App\Factory\Project\ProjectFactory;
|
|
use App\Tests\Fixtures\TestUser;
|
|
use App\Tests\Traits\RequestingTestTrait;
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
use Zenstruck\Foundry\Test\Factories;
|
|
use Zenstruck\Foundry\Test\ResetDatabase;
|
|
|
|
use function Zenstruck\Foundry\Persistence\save;
|
|
|
|
abstract class ProjectTestCase extends ApiTestCase
|
|
{
|
|
use ResetDatabase;
|
|
use Factories;
|
|
use RequestingTestTrait;
|
|
|
|
protected const BASE_URI = '/v4/projects';
|
|
|
|
public function setUp(): void
|
|
{
|
|
self::bootKernel();
|
|
|
|
save(CategoryFactory::createOne(['name' => 'test']));
|
|
}
|
|
|
|
// Auxiliary Methods
|
|
|
|
/**
|
|
* Defines the HTTP method that will be used in the requests made by the tests.
|
|
*
|
|
* @return string The HTTP method to be used for the request
|
|
* (e.g., 'GET', 'POST', 'PUT', 'DELETE').
|
|
*/
|
|
abstract protected function getMethod(): string;
|
|
|
|
protected function getUri(?int $id = null): string
|
|
{
|
|
$param = $id == null ? '' : "/$id";
|
|
|
|
return self::BASE_URI.$param;
|
|
}
|
|
|
|
protected function createTestProjectOptimized(int $count = 1, array $attributes = []): array
|
|
{
|
|
$owner = TestUser::get();
|
|
$territory = new Territory('ES');
|
|
|
|
$mergedAttributes = array_merge([
|
|
'owner' => $owner,
|
|
'territory' => $territory,
|
|
], $attributes);
|
|
|
|
return ProjectFactory::createMany($count, $mergedAttributes);
|
|
}
|
|
|
|
// Auxiliary Tests
|
|
|
|
protected function testOneNotFound(): void
|
|
{
|
|
$this->createTestProjectOptimized(1);
|
|
|
|
$this->request($this->getMethod(), $this->getUri(999), [], Response::HTTP_NOT_FOUND);
|
|
}
|
|
}
|