* 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 * feat: Update Users PATCH body (#246) * feat: move UserSignupDto to Dto\User namespace * fix: bad parsing of INSTR by ApiPlatform pagination layer * fix: make User resources be processed by dedicated update processor * fix: specify authentication usage of UserSignupDto::password property * feat: improve non-crawlable URI detection for ScoutService * feat: add "org" to Links with known organizations behind links * feat: map raw uri strings to full Link objects * fix: bad loading of existing user data in UserStateProcessor * feat: add NotExisting validator * feat: use NotExisting constraint on Users handle, email, Projects titles and Tipjar names * fix: check for existing node item in URI rel detection * fix: make app:oauth2-server:consent-client true by default * feat: bump league/oauth2-server-bundle to 1.2.2 * feat: add UserConverter decorator to have league/oauth2-server JWT's sub have User id instead of handle * fix: specify OAuth2 and separate server from client utilities * fix: make app_user_provider use ID instead of handle * feat: add explaining comment to doctrine_encryption.key_id * feat: add status to reward claims * feat: make default RewardClaim entity status in_pending * feat: add shorter check for ownership of projects * feat: allow to modify status of reward claims * feat: add shipping address to reward claims * fix: remove requirement of status in claim update op * fix: update filters and remove obsolete attributes from ProjectRewardClaim resource * feat: update DB layer for project reward claims * fix: code style issues by PHP-CS-Fixer * feat: add DoctrineLoggablePumpTrait to remove Gedmo Loggable event listener * fix: update legacy ref to FileUriException * feat: pump reward claim status and shipping address from v3 records * fix: update pumps batch sizes and injected dependencies * feat: pump user roles * feat: add true image cover retrieval and leave video as fallback for ProjectsPump * feat: pump project collaborations * feat: allow cascading of collaborations * fix: set isFulfilled of collaboration * fix: link collaboration to in-pumping project * fix: add trailing comma to list of fulfilling statuses * test: update PHPUnit CI to use bin/phpunit instead of action * feat: set memory_limit of PHPUnit run on CI to 128M * fix: add user avatar to user pump processing * fix: set invests batch size to 1 to avoid support duplicates on insert * Merge pull request #253 from goteo/fix/pumping-bugs fix: Pumping bugs
91 lines
2.6 KiB
PHP
91 lines
2.6 KiB
PHP
<?php
|
|
|
|
namespace App\Tests\Service\Scout;
|
|
|
|
use App\Service\Scout\InvalidUriException;
|
|
use App\Service\Scout\NonCrawlableUriException;
|
|
use App\Service\Scout\ScoutService;
|
|
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
|
|
|
class ScoutServiceTest extends KernelTestCase
|
|
{
|
|
private ScoutService $scout;
|
|
|
|
public function setUp(): void
|
|
{
|
|
self::bootKernel();
|
|
|
|
$this->scout = static::getContainer()->get(ScoutService::class);
|
|
}
|
|
|
|
/**
|
|
* @dataProvider provideNotUrls
|
|
*/
|
|
public function testThrowsExceptionOnUnrecognized(string $string)
|
|
{
|
|
$this->expectException(InvalidUriException::class);
|
|
|
|
$this->scout->get($string);
|
|
}
|
|
|
|
public function provideNotUrls()
|
|
{
|
|
return [
|
|
['not a url'],
|
|
['media'],
|
|
[''],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @dataProvider provideNonCrawlablePaths
|
|
*/
|
|
public function testThrowsExceptionOnNonCrawlablePaths(string $url)
|
|
{
|
|
$this->expectException(NonCrawlableUriException::class);
|
|
$this->expectExceptionMessageMatches(\sprintf('/%s/', \preg_quote($url, '/')));
|
|
|
|
$this->scout->get($url);
|
|
}
|
|
|
|
public function provideNonCrawlablePaths(): array
|
|
{
|
|
return [
|
|
['https://sialmaraz.es/wp-content/uploads/2025/01/MANIFESTACION-ALMARAZ-18_1.mp4'],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @dataProvider provideVideoUrls
|
|
*/
|
|
public function testGetsVideoCover(string $url)
|
|
{
|
|
$result = $this->scout->get($url);
|
|
|
|
$this->assertNotEmpty((string) $result->image);
|
|
$this->assertStringStartsWith('http', (string) $result->image);
|
|
$this->assertNotEmpty((string) $result->cover);
|
|
$this->assertStringStartsWith('http', (string) $result->cover);
|
|
$this->assertNotEquals((string) $result->image, (string) $result->cover);
|
|
}
|
|
|
|
public function provideVideoUrls(): array
|
|
{
|
|
return [
|
|
['vimeo.com/814460460'],
|
|
['www.vimeo.com/943036493'],
|
|
['https://vimeo.com/1006675057?share=copy#t=0'],
|
|
['https://vimeo.com/1034003653'],
|
|
['https://vimeo.com/1047182474/5a2a1cb70b?share=copy'],
|
|
['youtube.com/watch?v=D14QGWH2CfY'],
|
|
['www.youtube.com/watch?si=hbrQ4ZazrdwccLTk&v=pdfGwxa5Kwc&feature=youtu.be'],
|
|
['https://www.youtube.com/watch?v=47et__pjxZ8&t=6s'],
|
|
['https://www.youtube.com/watch?v=dQw4w9WgXcQ'],
|
|
['https://www.youtube.com/watch?v=oyYOBXDYGmY&ab_channel=Fes%21Cultura'],
|
|
['youtu.be/CLSXLA7jUsQ'],
|
|
['https://youtu.be/_crFO_jZ95o'],
|
|
['https://youtu.be/_URpSvDyod4?feature=shared'],
|
|
];
|
|
}
|
|
}
|