Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Feature/slide providers #43

Open
wants to merge 43 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
fecb97a
Add bundle test
discordier May 22, 2017
d48b61b
Add bundle extension to load config
discordier May 22, 2017
29aaa4a
Add phpunit to composer.json
discordier May 22, 2017
ebc22e1
Add vendor to .gitignore
discordier May 22, 2017
11deb9c
Add slide provider interface and registry
discordier May 22, 2017
e8db893
Add compiler pass to collect providers
discordier May 22, 2017
b0667ec
Load providers from registry if possible
discordier May 22, 2017
50707c8
Split news provider into own classes
discordier May 22, 2017
94de718
Split events provider into own classes
discordier May 22, 2017
641e8c5
Add bundles to require-dev and suggests
discordier May 22, 2017
72a8e2a
Split off default provider
discordier May 23, 2017
5994972
Fix type hints
discordier May 23, 2017
38f4e0b
Add deprecation notice
discordier May 23, 2017
336ced7
Speed up hook removal
discordier May 23, 2017
928a660
Add slider content class to buffer contents
discordier May 23, 2017
607a1e6
Add file handling
discordier May 23, 2017
e5ea63a
Add test
discordier May 23, 2017
01252c2
Remove fixme
discordier May 23, 2017
baf996a
Fix some deprecations
discordier May 23, 2017
26bb249
Refactoring image handling
discordier May 23, 2017
81b349c
Update phpunit config
discordier May 23, 2017
4175578
Add annotations to tests
discordier May 23, 2017
8d64700
New file helper class
discordier May 23, 2017
4c149f9
Extract model adapters into own config
discordier May 23, 2017
d328e17
Refactor default provider to use file helper
discordier May 23, 2017
ebffa8d
Improve tests
discordier May 23, 2017
2a4a564
Refactor file helper to usable in module
discordier May 23, 2017
05d0111
Allow to pass either a FilesModel instance or uuid
discordier May 23, 2017
35719e0
Extract mock method
discordier May 23, 2017
7950036
Add methods to recursively scan for files
discordier May 23, 2017
403438a
Utilize helper
discordier May 23, 2017
416866a
Optimize slider module
discordier May 23, 2017
f858b30
Fix typos in yml files
discordier May 23, 2017
cd82a95
Add travis.yml
discordier May 23, 2017
ff7c29e
Allow phpunit in php 5.6 (no 5.5 anymore, sorry)
discordier May 23, 2017
fe97bc6
add property hints
discordier May 23, 2017
e993164
Remove 5.5 also from .travis.yml
discordier May 23, 2017
4a36176
Make bridge creation mockable and add tests
discordier May 23, 2017
44971cf
Mark bridges as untestable
discordier May 23, 2017
90dbacc
More tests
discordier May 23, 2017
b457c08
We need at least phpunit 5.7 for the new classes
discordier May 23, 2017
70d7969
Improve DefaultSlidesProvider
discordier May 23, 2017
6b2ef54
Fix typo in class name
discordier May 23, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
More tests
discordier committed May 23, 2017

Verified

This commit was signed with the committer’s verified signature.
abnegate Jake Barnby
commit 90dbacc56906bd7b3b21e956b4542f22aa56d48d
62 changes: 62 additions & 0 deletions tests/SlideProvider/ImageSlideProviderTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?php

/*
* Copyright MADE/YOUR/DAY OG <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace MadeYourDay\RockSolidSlider\Test\SlideProvider;

use Contao\CoreBundle\Framework\Adapter;
use Contao\ModuleModel;
use MadeYourDay\RockSolidSlider\SlideProvider\ImageSlideProvider;
use MadeYourDay\RockSolidSlider\SliderContent;
use PHPUnit\Framework\TestCase;

/**
* Tests the ImageSlideProvider class.
*
* @author Christian Schiffler <[email protected]>
*/
class ImageSlideProviderTest extends TestCase
{
/**
* Tests the object instantiation.
*
* @covers \MadeYourDay\RockSolidSlider\SlideProvider\ImageSlideProvider::getName()
*/
public function testInstantiation()
{
$provider = new ImageSlideProvider(
$this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock()
);

$this->assertInstanceOf('MadeYourDay\RockSolidSlider\SlideProvider\ImageSlideProvider', $provider);
$this->assertSame('rsts_images', $provider->getName());
}

/**
* Test adding providers.
*
* @return void
*
* @covers \MadeYourDay\RockSolidSlider\SlideProvider\ImageSlideProvider::process()
* @uses \MadeYourDay\RockSolidSlider\SliderContent::addFiles()
* @uses \MadeYourDay\RockSolidSlider\SliderContent::getFiles()
* @uses \MadeYourDay\RockSolidSlider\SliderContent::hasFiles()
* @uses \MadeYourDay\RockSolidSlider\SliderContent::hasSlides()
*/
public function testProcess()
{
$provider = new ImageSlideProvider();
$content = new SliderContent();

$provider->process(['multiSRC' => serialize(['uuid1', 'uuid2'])], $content);

$this->assertFalse($content->hasSlides());
$this->assertTrue($content->hasFiles());
$this->assertSame(['uuid1', 'uuid2'], $content->getFiles());
}
}