Initial commit

This commit is contained in:
2018-04-02 08:07:38 +02:00
commit 7330c1ed3e
2054 changed files with 405203 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
<?php
namespace FluidTYPO3\Vhs\ViewHelpers\Media;
/*
* This file is part of the FluidTYPO3/Vhs project under GPLv2 or later.
*
* For the full copyright and license information, please read the
* LICENSE.md file that was distributed with this source code.
*/
use FluidTYPO3\Vhs\Tests\Unit\ViewHelpers\AbstractViewHelperTest;
/**
* @protection off
* @author Claus Due <claus@namelesscoder.net>
* @package Vhs
* @subpackage ViewHelpers\Media
*/
class AudioViewHelperTest extends AbstractViewHelperTest {
}

View File

@@ -0,0 +1,21 @@
<?php
namespace FluidTYPO3\Vhs\ViewHelpers\Media;
/*
* This file is part of the FluidTYPO3/Vhs project under GPLv2 or later.
*
* For the full copyright and license information, please read the
* LICENSE.md file that was distributed with this source code.
*/
use FluidTYPO3\Vhs\Tests\Unit\ViewHelpers\AbstractViewHelperTest;
/**
* @protection off
* @author Claus Due <claus@namelesscoder.net>
* @package Vhs
* @subpackage ViewHelpers\Media
*/
class ExistsViewHelperTest extends AbstractViewHelperTest {
}

View File

@@ -0,0 +1,59 @@
<?php
namespace FluidTYPO3\Vhs\ViewHelpers\Media;
/*
* This file is part of the FluidTYPO3/Vhs project under GPLv2 or later.
*
* For the full copyright and license information, please read the
* LICENSE.md file that was distributed with this source code.
*/
use FluidTYPO3\Vhs\Tests\Unit\ViewHelpers\AbstractViewHelperTest;
/**
* @author Björn Fromme <fromme@dreipunktnull.com>, dreipunktnull
* @package Vhs
* @subpackage ViewHelpers\Media
*/
class ExtensionViewHelperTest extends AbstractViewHelperTest {
/**
* @var string
*/
protected $fixturesPath;
/**
* Setup
*/
public function setUp() {
parent::setUp();
$this->fixturesPath = 'EXT:vhs/Tests/Fixtures/Files';
}
/**
* @test
*/
public function returnsEmptyStringForEmptyArguments() {
$viewHelper = $this->getMock('FluidTYPO3\Vhs\ViewHelpers\Media\ExtensionViewHelper', array('renderChildren'));
$viewHelper->expects($this->once())->method('renderChildren')->will($this->returnValue(NULL));
$this->assertEquals('', $viewHelper->render());
}
/**
* @test
*/
public function returnsExpectedExtensionForProvidedPath() {
$viewHelper = $this->getMock('FluidTYPO3\Vhs\ViewHelpers\Media\ExtensionViewHelper', array('renderChildren'));
$viewHelper->expects($this->once())->method('renderChildren')->will($this->returnValue($this->fixturesPath . '/foo.txt'));
$this->assertEquals('txt', $viewHelper->render());
}
/**
* @test
*/
public function returnsEmptyStringForFileWithoutExtension() {
$viewHelper = $this->getMock('FluidTYPO3\Vhs\ViewHelpers\Media\ExtensionViewHelper', array('renderChildren'));
$viewHelper->expects($this->once())->method('renderChildren')->will($this->returnValue($this->fixturesPath . '/noext'));
$this->assertEquals('', $viewHelper->render());
}
}

View File

@@ -0,0 +1,78 @@
<?php
namespace FluidTYPO3\Vhs\ViewHelpers\Media;
/*
* This file is part of the FluidTYPO3/Vhs project under GPLv2 or later.
*
* For the full copyright and license information, please read the
* LICENSE.md file that was distributed with this source code.
*/
use FluidTYPO3\Vhs\Tests\Unit\ViewHelpers\AbstractViewHelperTest;
/**
* @author Björn Fromme <fromme@dreipunktnull.com>, dreipunktnull
* @package Vhs
* @subpackage ViewHelpers\Media
*/
class FilesViewHelperTest extends AbstractViewHelperTest {
/**
* @var string
*/
protected $fixturesPath;
/**
* Setup
*/
public function setUp() {
parent::setUp();
$this->fixturesPath = dirname(__FILE__) . '/../../../Fixtures/Files';
}
/**
* @test
*/
public function returnsEmtpyArrayWhenArgumentsAreNotSet() {
$viewHelper = $this->getMock('FluidTYPO3\Vhs\ViewHelpers\Media\FilesViewHelper', array('renderChildren'));
$viewHelper->expects($this->once())->method('renderChildren')->will($this->returnValue(NULL));
$this->assertEquals(array(), $viewHelper->render());
}
/**
* @test
*/
public function returnsEmptyArrayWhenPathIsInaccessible() {
$viewHelper = $this->getMock('FluidTYPO3\Vhs\ViewHelpers\Media\FilesViewHelper', array('renderChildren'));
$viewHelper->expects($this->once())->method('renderChildren')->will($this->returnValue('/this/path/hopefully/does/not/exist'));
$this->assertEquals(array(), $viewHelper->render());
}
/**
* @test
*/
public function returnsPopulatedArrayOfAllFoundFiles() {
$viewHelper = $this->getMock('FluidTYPO3\Vhs\ViewHelpers\Media\FilesViewHelper', array('renderChildren'));
$viewHelper->expects($this->once())->method('renderChildren')->will($this->returnValue($this->fixturesPath));
$actualFiles = glob($this->fixturesPath . '/*');
$actualFilesCount = count($actualFiles);
$this->assertCount($actualFilesCount, $viewHelper->render());
}
/**
* @test
*/
public function returnsPopulatedArrayOfFilteredFiles() {
$viewHelper = $this->getMock('FluidTYPO3\Vhs\ViewHelpers\Media\FilesViewHelper', array('renderChildren'));
$viewHelper->expects($this->once())->method('renderChildren')->will($this->returnValue($this->fixturesPath));
$viewHelper->setArguments(array('extensionList' => 'txt'));
$actualFiles = glob($this->fixturesPath . '/*.txt');
$actualFilesCount = count($actualFiles);
$this->assertCount($actualFilesCount, $viewHelper->render());
}
}

View File

@@ -0,0 +1,47 @@
<?php
namespace FluidTYPO3\Vhs\Tests\Unit\ViewHelpers\Media;
/*
* This file is part of the FluidTYPO3/Vhs project under GPLv2 or later.
*
* For the full copyright and license information, please read the
* LICENSE.md file that was distributed with this source code.
*/
use FluidTYPO3\Vhs\Tests\Unit\ViewHelpers\AbstractViewHelperTest;
/**
* @protection off
* @author Juan Manuel Vergés Solanas <juanmanuel@vergessolanas.es>
* @package Vhs
* @subpackage ViewHelpers\Media
*/
class GravatarViewHelperTest extends AbstractViewHelperTest {
/**
* @var array
*/
protected $arguments = array(
'email' => 'juanmanuel.vergessolanas@gmail.com',
'secure' => FALSE,
);
/**
* @test
*/
public function generatesExpectedImgForEmailAddress() {
$expectedSource = 'http://www.gravatar.com/avatar/b1b0eddcbc4468db89f355ebb9cc3007';
preg_match('#src="([^"]*)"#', $this->executeViewHelper($this->arguments), $actualSource);
$this->assertSame($expectedSource, $actualSource[1]);
$expectedSource = 'https://secure.gravatar.com/avatar/b1b0eddcbc4468db89f355ebb9cc3007?s=160&amp;d=404&amp;r=pg';
$this->arguments = array(
'email' => 'juanmanuel.vergessolanas@gmail.com',
'size' => 160,
'imageSet' => '404',
'maximumRating' => 'pg',
'secure' => TRUE,
);
preg_match('#src="([^"]*)"#', $this->executeViewHelper($this->arguments), $actualSource);
$this->assertSame($expectedSource, $actualSource[1]);
}
}

View File

@@ -0,0 +1,75 @@
<?php
namespace FluidTYPO3\Vhs\Tests\Unit\ViewHelpers\Media\Image;
/*
* This file is part of the FluidTYPO3/Vhs project under GPLv2 or later.
*
* For the full copyright and license information, please read the
* LICENSE.md file that was distributed with this source code.
*/
use FluidTYPO3\Vhs\Tests\Unit\ViewHelpers\AbstractViewHelperTest;
/**
* @author Claus Due <claus@namelesscoder.net>
* @package Vhs
* @subpackage ViewHelpers\Media\Image
*/
class HeightViewHelperTest extends AbstractViewHelperTest {
/**
* @var string
*/
protected $fixturesPath;
/**
* Setup
*/
public function setUp() {
parent::setUp();
$this->fixturesPath = 'EXT:vhs/Tests/Fixtures/Files';
}
/**
* @test
*/
public function returnsZeroForEmptyArguments() {
$viewHelper = $this->getMock('FluidTYPO3\Vhs\ViewHelpers\Media\Image\HeightViewHelper', array('renderChildren'));
$viewHelper->expects($this->once())->method('renderChildren')->will($this->returnValue(NULL));
$this->assertEquals(0, $viewHelper->render());
}
/**
* @test
*/
public function returnsFileHeightAsInteger() {
$viewHelper = $this->getMock('FluidTYPO3\Vhs\ViewHelpers\Media\Image\HeightViewHelper', array('renderChildren'));
$viewHelper->expects($this->once())->method('renderChildren')->will($this->returnValue($this->fixturesPath . '/typo3_logo.jpg'));
$this->assertEquals(160, $viewHelper->render());
}
/**
* @test
*/
public function throwsExceptionWhenFileNotFound() {
$viewHelper = $this->getMock('FluidTYPO3\Vhs\ViewHelpers\Media\Image\HeightViewHelper', array('renderChildren'));
$viewHelper->expects($this->once())->method('renderChildren')->will($this->returnValue('/this/path/hopefully/does/not/exist.txt'));
$this->setExpectedException('TYPO3\CMS\Fluid\Core\ViewHelper\Exception');
$viewHelper->render();
}
/**
* @test
*/
public function throwsExceptionWhenFileIsNotAccessibleOrIsADirectory() {
$viewHelper = $this->getMock('FluidTYPO3\Vhs\ViewHelpers\Media\Image\HeightViewHelper', array('renderChildren'));
$viewHelper->expects($this->once())->method('renderChildren')->will($this->returnValue($this->fixturesPath));
$this->setExpectedException('TYPO3\CMS\Fluid\Core\ViewHelper\Exception');
$viewHelper->render();
}
}

View File

@@ -0,0 +1,75 @@
<?php
namespace FluidTYPO3\Vhs\Tests\Unit\ViewHelpers\Media\Image;
/*
* This file is part of the FluidTYPO3/Vhs project under GPLv2 or later.
*
* For the full copyright and license information, please read the
* LICENSE.md file that was distributed with this source code.
*/
use FluidTYPO3\Vhs\Tests\Unit\ViewHelpers\AbstractViewHelperTest;
/**
* @author Claus Due <claus@namelesscoder.net>
* @package Vhs
* @subpackage ViewHelpers\Media\Image
*/
class MimetypeViewHelperTest extends AbstractViewHelperTest {
/**
* @var string
*/
protected $fixturesPath;
/**
* Setup
*/
public function setUp() {
parent::setUp();
$this->fixturesPath = 'EXT:vhs/Tests/Fixtures/Files';
}
/**
* @test
*/
public function returnsZeroForEmptyArguments() {
$viewHelper = $this->getMock('FluidTYPO3\Vhs\ViewHelpers\Media\Image\MimetypeViewHelper', array('renderChildren'));
$viewHelper->expects($this->once())->method('renderChildren')->will($this->returnValue(NULL));
$this->assertEquals('', $viewHelper->render());
}
/**
* @test
*/
public function returnsFileMimetypeAsString() {
$viewHelper = $this->getMock('FluidTYPO3\Vhs\ViewHelpers\Media\Image\MimetypeViewHelper', array('renderChildren'));
$viewHelper->expects($this->once())->method('renderChildren')->will($this->returnValue($this->fixturesPath . '/typo3_logo.jpg'));
$this->assertEquals('image/jpeg', $viewHelper->render());
}
/**
* @test
*/
public function throwsExceptionWhenFileNotFound() {
$viewHelper = $this->getMock('FluidTYPO3\Vhs\ViewHelpers\Media\Image\MimetypeViewHelper', array('renderChildren'));
$viewHelper->expects($this->once())->method('renderChildren')->will($this->returnValue('/this/path/hopefully/does/not/exist.txt'));
$this->setExpectedException('TYPO3\CMS\Fluid\Core\ViewHelper\Exception');
$viewHelper->render();
}
/**
* @test
*/
public function throwsExceptionWhenFileIsNotAccessibleOrIsADirectory() {
$viewHelper = $this->getMock('FluidTYPO3\Vhs\ViewHelpers\Media\Image\MimetypeViewHelper', array('renderChildren'));
$viewHelper->expects($this->once())->method('renderChildren')->will($this->returnValue($this->fixturesPath));
$this->setExpectedException('TYPO3\CMS\Fluid\Core\ViewHelper\Exception');
$viewHelper->render();
}
}

View File

@@ -0,0 +1,75 @@
<?php
namespace FluidTYPO3\Vhs\Tests\Unit\ViewHelpers\Media\Image;
/*
* This file is part of the FluidTYPO3/Vhs project under GPLv2 or later.
*
* For the full copyright and license information, please read the
* LICENSE.md file that was distributed with this source code.
*/
use FluidTYPO3\Vhs\Tests\Unit\ViewHelpers\AbstractViewHelperTest;
/**
* @author Claus Due <claus@namelesscoder.net>
* @package Vhs
* @subpackage ViewHelpers\Media\Image
*/
class WidthViewHelperTest extends AbstractViewHelperTest {
/**
* @var string
*/
protected $fixturesPath;
/**
* Setup
*/
public function setUp() {
parent::setUp();
$this->fixturesPath = 'EXT:vhs/Tests/Fixtures/Files';
}
/**
* @test
*/
public function returnsZeroForEmptyArguments() {
$viewHelper = $this->getMock('FluidTYPO3\Vhs\ViewHelpers\Media\Image\WidthViewHelper', array('renderChildren'));
$viewHelper->expects($this->once())->method('renderChildren')->will($this->returnValue(NULL));
$this->assertEquals(0, $viewHelper->render());
}
/**
* @test
*/
public function returnsFileWidthAsInteger() {
$viewHelper = $this->getMock('FluidTYPO3\Vhs\ViewHelpers\Media\Image\WidthViewHelper', array('renderChildren'));
$viewHelper->expects($this->once())->method('renderChildren')->will($this->returnValue($this->fixturesPath . '/typo3_logo.jpg'));
$this->assertEquals(385, $viewHelper->render());
}
/**
* @test
*/
public function throwsExceptionWhenFileNotFound() {
$viewHelper = $this->getMock('FluidTYPO3\Vhs\ViewHelpers\Media\Image\WidthViewHelper', array('renderChildren'));
$viewHelper->expects($this->once())->method('renderChildren')->will($this->returnValue('/this/path/hopefully/does/not/exist.txt'));
$this->setExpectedException('TYPO3\CMS\Fluid\Core\ViewHelper\Exception');
$viewHelper->render();
}
/**
* @test
*/
public function throwsExceptionWhenFileIsNotAccessibleOrIsADirectory() {
$viewHelper = $this->getMock('FluidTYPO3\Vhs\ViewHelpers\Media\Image\WidthViewHelper', array('renderChildren'));
$viewHelper->expects($this->once())->method('renderChildren')->will($this->returnValue($this->fixturesPath));
$this->setExpectedException('TYPO3\CMS\Fluid\Core\ViewHelper\Exception');
$viewHelper->render();
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace FluidTYPO3\Vhs\ViewHelpers\Media;
/*
* This file is part of the FluidTYPO3/Vhs project under GPLv2 or later.
*
* For the full copyright and license information, please read the
* LICENSE.md file that was distributed with this source code.
*/
use FluidTYPO3\Vhs\Tests\Unit\ViewHelpers\AbstractViewHelperTest;
/**
* @protection off
* @author Claus Due <claus@namelesscoder.net>
* @package Vhs
* @subpackage ViewHelpers\Media
*/
class ImageViewHelperTest extends AbstractViewHelperTest {
}

View File

@@ -0,0 +1,20 @@
<?php
namespace FluidTYPO3\Vhs\ViewHelpers\Media;
/*
* This file is part of the FluidTYPO3/Vhs project under GPLv2 or later.
*
* For the full copyright and license information, please read the
* LICENSE.md file that was distributed with this source code.
*/
use FluidTYPO3\Vhs\Tests\Unit\ViewHelpers\AbstractViewHelperTest;
/**
* @author Björn Fromme <fromme@dreipunktnull.com>, dreipunktnull
* @package Vhs
* @subpackage ViewHelpers\Media
*/
class PdfThumbnailViewHelperTest extends AbstractViewHelperTest {
}

View File

@@ -0,0 +1,21 @@
<?php
namespace FluidTYPO3\Vhs\ViewHelpers\Media;
/*
* This file is part of the FluidTYPO3/Vhs project under GPLv2 or later.
*
* For the full copyright and license information, please read the
* LICENSE.md file that was distributed with this source code.
*/
use FluidTYPO3\Vhs\Tests\Unit\ViewHelpers\AbstractViewHelperTest;
/**
* @protection off
* @author Claus Due <claus@namelesscoder.net>
* @package Vhs
* @subpackage ViewHelpers\Media
*/
class PictureViewHelperTest extends AbstractViewHelperTest {
}

View File

@@ -0,0 +1,75 @@
<?php
namespace FluidTYPO3\Vhs\ViewHelpers\Media;
/*
* This file is part of the FluidTYPO3/Vhs project under GPLv2 or later.
*
* For the full copyright and license information, please read the
* LICENSE.md file that was distributed with this source code.
*/
use FluidTYPO3\Vhs\Tests\Unit\ViewHelpers\AbstractViewHelperTest;
/**
* @author Björn Fromme <fromme@dreipunktnull.com>, dreipunktnull
* @package Vhs
* @subpackage ViewHelpers\Media
*/
class SizeViewHelperTest extends AbstractViewHelperTest {
/**
* @var string
*/
protected $fixturesPath;
/**
* Setup
*/
public function setUp() {
parent::setUp();
$this->fixturesPath = 'EXT:vhs/Tests/Fixtures/Files';
}
/**
* @test
*/
public function returnsZeroForEmptyArguments() {
$viewHelper = $this->getMock('FluidTYPO3\Vhs\ViewHelpers\Media\SizeViewHelper', array('renderChildren'));
$viewHelper->expects($this->once())->method('renderChildren')->will($this->returnValue(NULL));
$this->assertEquals(0, $viewHelper->render());
}
/**
* @test
*/
public function returnsFileSizeAsInteger() {
$viewHelper = $this->getMock('FluidTYPO3\Vhs\ViewHelpers\Media\SizeViewHelper', array('renderChildren'));
$viewHelper->expects($this->once())->method('renderChildren')->will($this->returnValue($this->fixturesPath . '/typo3_logo.jpg'));
$this->assertEquals(7094, $viewHelper->render());
}
/**
* @test
*/
public function throwsExceptionWhenFileNotFound() {
$viewHelper = $this->getMock('FluidTYPO3\Vhs\ViewHelpers\Media\SizeViewHelper', array('renderChildren'));
$viewHelper->expects($this->once())->method('renderChildren')->will($this->returnValue('/this/path/hopefully/does/not/exist.txt'));
$this->setExpectedException('TYPO3\CMS\Fluid\Core\ViewHelper\Exception');
$viewHelper->render();
}
/**
* @test
*/
public function throwsExceptionWhenFileIsNotAccessibleOrIsADirectory() {
$viewHelper = $this->getMock('FluidTYPO3\Vhs\ViewHelpers\Media\SizeViewHelper', array('renderChildren'));
$viewHelper->expects($this->once())->method('renderChildren')->will($this->returnValue($this->fixturesPath));
$this->setExpectedException('TYPO3\CMS\Fluid\Core\ViewHelper\Exception');
$viewHelper->render();
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace FluidTYPO3\Vhs\ViewHelpers\Media;
/*
* This file is part of the FluidTYPO3/Vhs project under GPLv2 or later.
*
* For the full copyright and license information, please read the
* LICENSE.md file that was distributed with this source code.
*/
use FluidTYPO3\Vhs\Tests\Unit\ViewHelpers\AbstractViewHelperTest;
/**
* @protection off
* @author Claus Due <claus@namelesscoder.net>
* @package Vhs
* @subpackage ViewHelpers\Media
*/
class SourceViewHelperTest extends AbstractViewHelperTest {
}

View File

@@ -0,0 +1,21 @@
<?php
namespace FluidTYPO3\Vhs\ViewHelpers\Media;
/*
* This file is part of the FluidTYPO3/Vhs project under GPLv2 or later.
*
* For the full copyright and license information, please read the
* LICENSE.md file that was distributed with this source code.
*/
use FluidTYPO3\Vhs\Tests\Unit\ViewHelpers\AbstractViewHelperTest;
/**
* @protection off
* @author Claus Due <claus@namelesscoder.net>
* @package Vhs
* @subpackage ViewHelpers\Media
*/
class SpotifyViewHelperTest extends AbstractViewHelperTest {
}

View File

@@ -0,0 +1,21 @@
<?php
namespace FluidTYPO3\Vhs\ViewHelpers\Media;
/*
* This file is part of the FluidTYPO3/Vhs project under GPLv2 or later.
*
* For the full copyright and license information, please read the
* LICENSE.md file that was distributed with this source code.
*/
use FluidTYPO3\Vhs\Tests\Unit\ViewHelpers\AbstractViewHelperTest;
/**
* @protection off
* @author Claus Due <claus@namelesscoder.net>
* @package Vhs
* @subpackage ViewHelpers\Media
*/
class VideoViewHelperTest extends AbstractViewHelperTest {
}

View File

@@ -0,0 +1,21 @@
<?php
namespace FluidTYPO3\Vhs\ViewHelpers\Media;
/*
* This file is part of the FluidTYPO3/Vhs project under GPLv2 or later.
*
* For the full copyright and license information, please read the
* LICENSE.md file that was distributed with this source code.
*/
use FluidTYPO3\Vhs\Tests\Unit\ViewHelpers\AbstractViewHelperTest;
/**
* @protection off
* @author Claus Due <claus@namelesscoder.net>
* @package Vhs
* @subpackage ViewHelpers\Media
*/
class VimeoViewHelperTest extends AbstractViewHelperTest {
}

View File

@@ -0,0 +1,55 @@
<?php
namespace FluidTYPO3\Vhs\ViewHelpers\Media;
/*
* This file is part of the FluidTYPO3/Vhs project under GPLv2 or later.
*
* For the full copyright and license information, please read the
* LICENSE.md file that was distributed with this source code.
*/
use FluidTYPO3\Vhs\Tests\Unit\ViewHelpers\AbstractViewHelperTest;
/**
* @protection off
* @author Claus Due <claus@namelesscoder.net>
* @package Vhs
* @subpackage ViewHelpers\Media
*/
class YoutubeViewHelperTest extends AbstractViewHelperTest {
/**
* @var array
*/
protected $arguments = array(
'videoId' => '',
'width' => 640,
'height' => 385,
'autoplay' => FALSE,
'legacyCode' => FALSE,
'showRelated' => FALSE,
'extendedPrivacy' => TRUE,
'hideControl' => FALSE,
'hideInfo' => FALSE,
'playlist' => '',
'loop' => FALSE,
'start' => 30,
'end' => '',
'lightTheme' => FALSE,
'videoQuality' => ''
);
/**
* @test
*/
public function compareResult() {
$this->arguments['videoId'] = 'M7lc1UVf-VE';
$this->arguments['hideInfo'] = TRUE;
$this->arguments['start'] = 30;
preg_match('#src="([^"]*)"#', $this->executeViewHelper($this->arguments), $actualSource);
$expectedSource = '//www.youtube-nocookie.com/embed/M7lc1UVf-VE?rel=0&amp;showinfo=0&amp;start=30';
$this->assertSame($expectedSource, $actualSource[1]);
}
}