-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathDeprecatedAutoloaderTest.php
More file actions
78 lines (68 loc) · 2.41 KB
/
Copy pathDeprecatedAutoloaderTest.php
File metadata and controls
78 lines (68 loc) · 2.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
/**
* This file is part of MetaModels/attribute_translatedfile.
*
* (c) 2012-2021 The MetaModels team.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* This project is provided in good faith and hope to be usable by anyone.
*
* @package MetaModels/attribute_translatedfile
* @author David Molineus <david.molineus@netzmacht.de>
* @author Sven Baumann <baumann.sv@gmail.com>
* @copyright 2012-2021 The MetaModels team.
* @license https://github.com/MetaModels/attribute_translatedfile/blob/master/LICENSE LGPL-3.0-or-later
* @filesource
*/
namespace MetaModels\AttributeTranslatedFileBundle\Test;
use MetaModels\AttributeTranslatedFileBundle\Attribute\AttributeTypeFactory;
use MetaModels\AttributeTranslatedFileBundle\Attribute\TranslatedFile;
use PHPUnit\Framework\TestCase;
/**
* This class tests if the deprecated autoloader works.
*
* @covers \MetaModels\AttributeTranslatedFileBundle\Attribute\TranslatedFile
* @covers \MetaModels\AttributeTranslatedFileBundle\Attribute\AttributeTypeFactory
*/
class DeprecatedAutoloaderTest extends TestCase
{
/**
* TranslatedFilees of old classes to the new one.
*
* @var array
*/
private static $classes = [
'MetaModels\Attribute\TranslatedFile\TranslatedFile' => TranslatedFile::class,
'MetaModels\Attribute\TranslatedFile\AttributeTypeFactory' => AttributeTypeFactory::class
];
/**
* Provide the file class map.
*
* @return array
*/
public function provideFileClassMap()
{
$values = [];
foreach (static::$classes as $translatedFile => $class) {
$values[] = [$translatedFile, $class];
}
return $values;
}
/**
* Test if the deprecated classes are fileed to the new one.
*
* @param string $oldClass Old class name.
* @param string $newClass New class name.
*
* @dataProvider provideFileClassMap
*/
public function testDeprecatedClassesAreFileed($oldClass, $newClass)
{
self::assertTrue(class_exists($oldClass), sprintf('Class TranslatedFile "%s" is not found.', $oldClass));
$oldClassReflection = new \ReflectionClass($oldClass);
$newClassReflection = new \ReflectionClass($newClass);
self::assertSame($newClassReflection->getFileName(), $oldClassReflection->getFileName());
}
}