Verzeichnisstruktur phpBB-3.2.0
- Veröffentlicht
- 06.01.2017
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
CanProxyAssertionTest.php
001 <?php
002 /*
003 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
004 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
005 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
006 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
007 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
008 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
009 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
010 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
011 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
012 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
013 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
014 *
015 * This software consists of voluntary contributions made by many individuals
016 * and is licensed under the MIT license.
017 */
018
019 namespace ProxyManagerTest\ProxyGenerator\Assertion;
020
021 use PHPUnit_Framework_TestCase;
022 use ProxyManager\ProxyGenerator\Assertion\CanProxyAssertion;
023 use ReflectionClass;
024
025 /**
026 * Tests for {@see \ProxyManager\ProxyGenerator\Assertion\CanProxyAssertion}
027 *
028 * @author Marco Pivetta <ocramius@gmail.com>
029 * @license MIT
030 *
031 * @covers \ProxyManager\ProxyGenerator\Assertion\CanProxyAssertion
032 * @group Coverage
033 */
034 class CanProxyAssertionTest extends PHPUnit_Framework_TestCase
035 {
036 public function testDeniesFinalClasses()
037 {
038 $this->setExpectedException('ProxyManager\Exception\InvalidProxiedClassException');
039
040 CanProxyAssertion::assertClassCanBeProxied(new ReflectionClass('ProxyManagerTestAsset\\FinalClass'));
041 }
042
043 public function testDeniesClassesWithAbstractProtectedMethods()
044 {
045 $this->setExpectedException('ProxyManager\Exception\InvalidProxiedClassException');
046
047 CanProxyAssertion::assertClassCanBeProxied(new ReflectionClass(
048 'ProxyManagerTestAsset\\ClassWithAbstractProtectedMethod'
049 ));
050 }
051
052 public function testAllowsInterfaceByDefault()
053 {
054 CanProxyAssertion::assertClassCanBeProxied(new ReflectionClass(
055 'ProxyManagerTestAsset\\BaseInterface'
056 ));
057
058 $this->assertTrue(true); // not nice, but assertions are just fail-checks, no real code executed
059 }
060
061 public function testDeniesInterfaceIfSpecified()
062 {
063 $this->setExpectedException('ProxyManager\Exception\InvalidProxiedClassException');
064
065 CanProxyAssertion::assertClassCanBeProxied(new ReflectionClass('ProxyManagerTestAsset\\BaseInterface'), false);
066 }
067
068 /**
069 * @param string $className
070 *
071 * @dataProvider validClasses
072 */
073 public function testAllowedClass($className)
074 {
075 CanProxyAssertion::assertClassCanBeProxied(new ReflectionClass($className));
076
077 $this->assertTrue(true); // not nice, but assertions are just fail-checks, no real code executed
078 }
079
080 public function testDisallowsConstructor()
081 {
082 $this->setExpectedException('BadMethodCallException');
083
084 new CanProxyAssertion();
085 }
086
087 /**
088 * @return string[][]
089 */
090 public function validClasses()
091 {
092 return array(
093 array('ProxyManagerTestAsset\AccessInterceptorValueHolderMock'),
094 array('ProxyManagerTestAsset\BaseClass'),
095 array('ProxyManagerTestAsset\BaseInterface'),
096 array('ProxyManagerTestAsset\CallableTypeHintClass'),
097 array('ProxyManagerTestAsset\ClassWithByRefMagicMethods'),
098 array('ProxyManagerTestAsset\ClassWithFinalMagicMethods'),
099 array('ProxyManagerTestAsset\ClassWithFinalMethods'),
100 array('ProxyManagerTestAsset\ClassWithMethodWithDefaultParameters'),
101 array('ProxyManagerTestAsset\ClassWithMixedProperties'),
102 array('ProxyManagerTestAsset\ClassWithPrivateProperties'),
103 array('ProxyManagerTestAsset\ClassWithProtectedProperties'),
104 array('ProxyManagerTestAsset\ClassWithPublicProperties'),
105 array('ProxyManagerTestAsset\ClassWithPublicArrayProperty'),
106 array('ProxyManagerTestAsset\ClassWithSelfHint'),
107 array('ProxyManagerTestAsset\EmptyClass'),
108 array('ProxyManagerTestAsset\HydratedObject'),
109 array('ProxyManagerTestAsset\LazyLoadingMock'),
110 array('ProxyManagerTestAsset\NullObjectMock'),
111 );
112 }
113 }
114