feat: CI/CD pipeline setup complete - Ansible playbooks updated, secrets configured, workflow ready
This commit is contained in:
@@ -2,35 +2,48 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use App\Framework\Cache\Driver\InMemoryCache;
|
||||
use App\Framework\Cache\GeneralCache;
|
||||
use App\Framework\Core\ValueObjects\Byte;
|
||||
use App\Framework\Filesystem\InMemoryStorage;
|
||||
use App\Framework\Http\HttpRequest;
|
||||
use App\Framework\Http\Responses\JsonResponse;
|
||||
use App\Framework\LiveComponents\Controllers\ChunkedUploadController;
|
||||
use App\Framework\LiveComponents\Services\CacheUploadSessionStore;
|
||||
use App\Framework\LiveComponents\Services\ChunkAssembler;
|
||||
use App\Framework\LiveComponents\Services\ChunkedUploadManager;
|
||||
use App\Framework\LiveComponents\Services\IntegrityValidator;
|
||||
use App\Framework\LiveComponents\Services\UploadProgressTracker;
|
||||
use App\Framework\LiveComponents\Services\UploadProgressTrackerInterface;
|
||||
use App\Framework\LiveComponents\Services\UploadSessionIdGenerator;
|
||||
use App\Framework\LiveComponents\Services\UploadSessionStore;
|
||||
use App\Framework\LiveComponents\ValueObjects\ChunkHash;
|
||||
use App\Framework\LiveComponents\ValueObjects\UploadSessionId;
|
||||
use App\Framework\Random\SecureRandomGenerator;
|
||||
use App\Framework\Router\Result\Status;
|
||||
use App\Framework\Serializer\Php\PhpSerializer;
|
||||
|
||||
beforeEach(function () {
|
||||
// Setup dependencies
|
||||
$this->sessionIdGenerator = new UploadSessionIdGenerator();
|
||||
$this->sessionStore = new UploadSessionStore();
|
||||
$this->integrityValidator = new IntegrityValidator();
|
||||
$this->chunkAssembler = new ChunkAssembler();
|
||||
$randomGenerator = new SecureRandomGenerator();
|
||||
$this->sessionIdGenerator = new UploadSessionIdGenerator($randomGenerator);
|
||||
|
||||
// Setup cache for session store
|
||||
$inMemoryCache = new InMemoryCache();
|
||||
$serializer = new PhpSerializer();
|
||||
$cache = new GeneralCache($inMemoryCache, $serializer);
|
||||
$this->sessionStore = new CacheUploadSessionStore($cache);
|
||||
|
||||
$this->fileStorage = new InMemoryStorage();
|
||||
$this->integrityValidator = new IntegrityValidator();
|
||||
$this->chunkAssembler = new ChunkAssembler($this->fileStorage);
|
||||
|
||||
// Mock progress tracker (no SSE in tests)
|
||||
$this->progressTracker = new class {
|
||||
public function broadcastInitialized($session, $userId): void {}
|
||||
public function broadcastChunkUploaded($session, $userId): void {}
|
||||
public function broadcastCompleted($session, $userId): void {}
|
||||
public function broadcastAborted($sessionId, $userId, $reason): void {}
|
||||
$this->progressTracker = new class implements UploadProgressTrackerInterface {
|
||||
public function broadcastInitialized($session, $userId): int { return 0; }
|
||||
public function broadcastChunkUploaded($session, $userId): int { return 0; }
|
||||
public function broadcastCompleted($session, $userId): int { return 0; }
|
||||
public function broadcastAborted($sessionId, $userId, $reason = 'User cancelled'): int { return 0; }
|
||||
public function broadcastError($sessionId, $userId, $error): int { return 0; }
|
||||
public function broadcastQuarantineStatus($session, $userId): int { return 0; }
|
||||
public function getProgress($sessionId): ?array { return null; }
|
||||
};
|
||||
|
||||
|
||||
@@ -12,13 +12,18 @@ use App\Domain\PreSave\ValueObjects\CampaignStatus;
|
||||
use App\Domain\PreSave\ValueObjects\RegistrationStatus;
|
||||
use App\Domain\PreSave\ValueObjects\StreamingPlatform;
|
||||
use App\Domain\PreSave\ValueObjects\TrackUrl;
|
||||
use App\Framework\Core\ValueObjects\Duration;
|
||||
use App\Framework\Core\ValueObjects\Timestamp;
|
||||
use App\Framework\Exception\FrameworkException;
|
||||
use App\Framework\Logging\Logger;
|
||||
use App\Framework\OAuth\OAuthServiceInterface;
|
||||
use App\Framework\OAuth\Providers\SupportsPreSaves;
|
||||
use App\Framework\OAuth\Storage\StoredOAuthToken;
|
||||
use App\Framework\OAuth\ValueObjects\AccessToken;
|
||||
use App\Framework\OAuth\ValueObjects\OAuthToken;
|
||||
use App\Framework\OAuth\ValueObjects\RefreshToken;
|
||||
use App\Framework\OAuth\ValueObjects\TokenScope;
|
||||
use App\Framework\OAuth\ValueObjects\TokenType;
|
||||
|
||||
// In-Memory Campaign Repository for Integration Testing
|
||||
class IntegrationCampaignRepository implements PreSaveCampaignRepositoryInterface
|
||||
@@ -61,7 +66,7 @@ class IntegrationCampaignRepository implements PreSaveCampaignRepositoryInterfac
|
||||
$now = Timestamp::now();
|
||||
return array_values(array_filter(
|
||||
$this->campaigns,
|
||||
fn($c) => $c->status === CampaignStatus::SCHEDULED
|
||||
fn($c) => ($c->status === CampaignStatus::SCHEDULED || $c->status === CampaignStatus::ACTIVE)
|
||||
&& $c->releaseDate->isBefore($now)
|
||||
));
|
||||
}
|
||||
@@ -193,14 +198,17 @@ class IntegrationOAuthService implements OAuthServiceInterface
|
||||
|
||||
// Create a token for this provider
|
||||
$this->tokens[$userId . '_' . $provider] = new StoredOAuthToken(
|
||||
id: null, // Auto-increment ID in real storage
|
||||
userId: $userId,
|
||||
provider: $provider,
|
||||
token: new OAuthToken(
|
||||
accessToken: 'test_access_token_' . $userId,
|
||||
tokenType: 'Bearer',
|
||||
expiresIn: 3600,
|
||||
refreshToken: 'test_refresh_token_' . $userId,
|
||||
scope: ['user-library-modify']
|
||||
accessToken: AccessToken::create(
|
||||
'test_access_token_' . $userId,
|
||||
Timestamp::now()->add(Duration::fromHours(1)) // Expires in 1 hour
|
||||
),
|
||||
refreshToken: new RefreshToken('test_refresh_token_' . $userId),
|
||||
tokenType: TokenType::BEARER,
|
||||
scope: TokenScope::fromString('user-library-modify')
|
||||
),
|
||||
createdAt: Timestamp::now(),
|
||||
updatedAt: Timestamp::now()
|
||||
|
||||
@@ -316,9 +316,14 @@ describe('SmartLink Integration', function () {
|
||||
// Delete link
|
||||
$this->service->deleteLink($link->id);
|
||||
|
||||
// Verify link is deleted
|
||||
expect(fn() => $this->service->findById($link->id))
|
||||
->toThrow(\App\Domain\SmartLink\Exceptions\SmartLinkNotFoundException::class);
|
||||
// Verify link is deleted - use try-catch instead of toThrow()
|
||||
$threwCorrectException = false;
|
||||
try {
|
||||
$this->service->findById($link->id);
|
||||
} catch (\App\Domain\SmartLink\Exceptions\SmartLinkNotFoundException $e) {
|
||||
$threwCorrectException = true;
|
||||
}
|
||||
expect($threwCorrectException)->toBeTrue();
|
||||
|
||||
// Verify destinations are deleted (getDestinations returns empty array)
|
||||
$afterDelete = $this->service->getDestinations($link->id);
|
||||
|
||||
Reference in New Issue
Block a user