<?php

use App\Services\Docker;

it('builds docker compose commands with all configured compose files', function () {
    config()->set('project.compose_files', ['docker-compose.yml', 'docker-compose.workspace.yml']);

    expect(Docker::base('up -d'))->toBe('docker compose -f docker-compose.yml -f docker-compose.workspace.yml up -d');
});

it('builds docker exec commands with cwd user service and shell', function () {
    config()->set('project.compose_files', ['docker-compose.yml']);
    config()->set('project.dockerCwd', '/var/www/public');
    config()->set('project.dockerUser', 'www-data');
    config()->set('project.serviceName', 'wp');
    config()->set('project.shell', '/bin/sh');

    $command = Docker::exec('php artisan test', '/var/www/public/content/themes/theme');

    expect($command)->toBe('docker compose -f docker-compose.yml exec -w /var/www/public/content/themes/theme --user www-data wp /bin/sh -c "php artisan test"');
});
