Skip to content

Commit

Permalink
Merge 4.x into 5.x
Browse files Browse the repository at this point in the history
  • Loading branch information
SonataCI committed Nov 14, 2021
2 parents ac93833 + 88827a6 commit 095c117
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 2 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
},
"require-dev": {
"aws/aws-sdk-php": "^3.0",
"doctrine/doctrine-bundle": "^2.3.2",
"doctrine/mongodb-odm": "^2.2",
"doctrine/orm": "^2.9",
"jackalope/jackalope-doctrine-dbal": "^1.1",
Expand Down
1 change: 1 addition & 0 deletions tests/App/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
uploads
4 changes: 2 additions & 2 deletions tests/App/Resources/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ sonata_media:

filesystem:
local:
directory: "%kernel.project_dir%/public/uploads/media"
create: false
directory: "%kernel.project_dir%/uploads"
create: true

s3:
bucket: my-bucket
Expand Down
52 changes: 52 additions & 0 deletions tests/Functional/Command/AddMediaCommandTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php

declare(strict_types=1);

/*
* This file is part of the Sonata Project package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Sonata\MediaBundle\Tests\Functional\Command;

use Sonata\MediaBundle\Tests\App\AppKernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\Console\Tester\CommandTester;

final class AddMediaCommandTest extends KernelTestCase
{
private CommandTester $commandTester;

protected function setUp(): void
{
static::bootKernel();

$this->commandTester = new CommandTester(
(new Application(static::createKernel()))->find('sonata:media:add')
);
}

public function testAddsMedia(): void
{
$this->commandTester->execute([
'providerName' => 'sonata.media.provider.image',
'context' => 'default',
'binaryContent' => realpath(__DIR__.'/../../Fixtures/logo.png'),
]);

static::assertStringContainsString('done!', $this->commandTester->getDisplay());
}

/**
* @return class-string<\Symfony\Component\HttpKernel\KernelInterface>
*/
protected static function getKernelClass(): string
{
return AppKernel::class;
}
}
37 changes: 37 additions & 0 deletions tests/custom_bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

declare(strict_types=1);

/*
* This file is part of the Sonata Project package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

use Sonata\MediaBundle\Tests\App\AppKernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\NullOutput;

$application = new Application(new AppKernel());
$application->setAutoExit(false);

$input = new ArrayInput([
'command' => 'doctrine:database:drop',
'--force' => true,
]);
$application->run($input, new NullOutput());

$input = new ArrayInput([
'command' => 'doctrine:database:create',
'--no-interaction' => true,
]);
$application->run($input, new NullOutput());

$input = new ArrayInput([
'command' => 'doctrine:schema:create',
]);
$application->run($input, new NullOutput());

0 comments on commit 095c117

Please sign in to comment.