[CLEANUP] Rework/simplify copyright header and remove @package
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Tests / Unit / Property / TypeConverter / StringConverterTest.php
1 <?php
2 namespace TYPO3\CMS\Extbase\Tests\Unit\Property\TypeConverter;
3
4 /*
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 /**
18 * Test case
19 */
20 class StringConverterTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
21
22 /**
23 * @var \TYPO3\CMS\Extbase\Property\TypeConverterInterface
24 */
25 protected $converter;
26
27 public function setUp() {
28 $this->converter = new \TYPO3\CMS\Extbase\Property\TypeConverter\StringConverter();
29 }
30
31 /**
32 * @test
33 */
34 public function checkMetadata() {
35 $this->assertEquals(array('string', 'integer'), $this->converter->getSupportedSourceTypes(), 'Source types do not match');
36 $this->assertEquals('string', $this->converter->getSupportedTargetType(), 'Target type does not match');
37 $this->assertEquals(1, $this->converter->getPriority(), 'Priority does not match');
38 }
39
40 /**
41 * @test
42 */
43 public function convertFromShouldReturnSourceString() {
44 $this->assertEquals('myString', $this->converter->convertFrom('myString', 'string'));
45 }
46
47 /**
48 * @test
49 */
50 public function canConvertFromShouldReturnTrue() {
51 $this->assertTrue($this->converter->canConvertFrom('myString', 'string'));
52 }
53
54 /**
55 * @test
56 */
57 public function getSourceChildPropertiesToBeConvertedShouldReturnEmptyArray() {
58 $this->assertEquals(array(), $this->converter->getSourceChildPropertiesToBeConverted('myString'));
59 }
60 }