Skip to content

Commit 40e6d8e

Browse files
author
marekrzytki
committed
Fix spec tests
1 parent b83e1a4 commit 40e6d8e

2 files changed

Lines changed: 15 additions & 15 deletions

File tree

spec/Entity/MediaSpec.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,26 @@
1717
use Sylius\Component\Core\Model\ChannelInterface;
1818
use Sylius\Component\Core\Model\ProductInterface;
1919
use Sylius\Component\Resource\Model\ResourceInterface;
20-
use Symfony\Component\HttpFoundation\File\File;
20+
use Symfony\Component\HttpFoundation\File\UploadedFile;
2121

2222
final class MediaSpec extends ObjectBehavior
2323
{
24-
function it_is_initializable(): void
24+
public function it_is_initializable(): void
2525
{
2626
$this->shouldHaveType(Media::class);
2727
}
2828

29-
function it_is_a_resource(): void
29+
public function it_is_a_resource(): void
3030
{
3131
$this->shouldHaveType(ResourceInterface::class);
3232
}
3333

34-
function it_implements_media_interface(): void
34+
public function it_implements_media_interface(): void
3535
{
3636
$this->shouldHaveType(MediaInterface::class);
3737
}
3838

39-
function it_allows_access_via_properties(): void
39+
public function it_allows_access_via_properties(): void
4040
{
4141
$this->setCode('file');
4242
$this->getCode()->shouldReturn('file');
@@ -47,7 +47,7 @@ function it_allows_access_via_properties(): void
4747
$this->setPath('/media/video');
4848
$this->getPath()->shouldReturn('/media/video');
4949

50-
$file = new File(__DIR__ . '/MediaSpec.php');
50+
$file = new UploadedFile(__DIR__ . '/MediaSpec.php', 'originalName');
5151

5252
$this->setFile($file);
5353
$this->getFile()->shouldReturn($file);
@@ -56,7 +56,7 @@ function it_allows_access_via_properties(): void
5656
$this->getMimeType()->shouldReturn('video/mp4');
5757
}
5858

59-
function it_toggles(): void
59+
public function it_toggles(): void
6060
{
6161
$this->enable();
6262
$this->isEnabled()->shouldReturn(true);
@@ -65,7 +65,7 @@ function it_toggles(): void
6565
$this->isEnabled()->shouldReturn(false);
6666
}
6767

68-
function it_associates_products(ProductInterface $firstProduct, ProductInterface $secondProduct): void
68+
public function it_associates_products(ProductInterface $firstProduct, ProductInterface $secondProduct): void
6969
{
7070
$this->addProduct($firstProduct);
7171
$this->hasProduct($firstProduct)->shouldReturn(true);
@@ -77,7 +77,7 @@ function it_associates_products(ProductInterface $firstProduct, ProductInterface
7777
$this->hasProduct($firstProduct)->shouldReturn(false);
7878
}
7979

80-
function it_associates_sections(SectionInterface $firstSection, SectionInterface $secondSection): void
80+
public function it_associates_sections(SectionInterface $firstSection, SectionInterface $secondSection): void
8181
{
8282
$this->addSection($firstSection);
8383
$this->hasSection($firstSection)->shouldReturn(true);
@@ -89,7 +89,7 @@ function it_associates_sections(SectionInterface $firstSection, SectionInterface
8989
$this->hasSection($firstSection)->shouldReturn(false);
9090
}
9191

92-
function it_associates_channels(ChannelInterface $firstChannel, ChannelInterface $secondChannel): void
92+
public function it_associates_channels(ChannelInterface $firstChannel, ChannelInterface $secondChannel): void
9393
{
9494
$this->addChannel($firstChannel);
9595
$this->hasChannel($firstChannel)->shouldReturn(true);

spec/Media/Provider/FileProviderSpec.php renamed to spec/MediaProvider/GenericProviderSpec.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,21 @@
1717
use PhpSpec\ObjectBehavior;
1818
use Twig\Environment;
1919

20-
final class FileProviderSpec extends ObjectBehavior
20+
final class GenericProviderSpec extends ObjectBehavior
2121
{
22-
function let(
22+
public function let(
2323
MediaUploaderInterface $uploader,
2424
Environment $twigEngine
2525
) {
2626
$this->beConstructedWith($uploader, $twigEngine, '@Template', '/media/');
2727
}
2828

29-
function it_is_initializable(): void
29+
public function it_is_initializable(): void
3030
{
3131
$this->shouldHaveType(GenericProvider::class);
3232
}
3333

34-
function it_implements_provider_interface(): void
34+
public function it_implements_provider_interface(): void
3535
{
3636
$this->shouldHaveType(ProviderInterface::class);
3737
}
@@ -40,7 +40,7 @@ public function it_renders(MediaInterface $media, Environment $twigEngine): void
4040
{
4141
$twigEngine->render('@Template', ['media' => $media, 'config' => []])->willReturn('content');
4242

43-
$this->render($media, ['config' => []])->shouldReturn('content');
43+
$this->render($media, '@Template', ['config' => []])->shouldReturn('content');
4444
}
4545

4646
public function it_uploads(MediaInterface $media, MediaUploaderInterface $uploader): void

0 commit comments

Comments
 (0)