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.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

RemoteObjectMethodTest.php

Zuletzt modifiziert: 09.10.2024, 12:59 - Dateigröße: 4.58 KiB


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\RemoteObject\MethodGenerator;
020   
021  use PHPUnit_Framework_TestCase;
022  use ProxyManager\ProxyGenerator\RemoteObject\MethodGenerator\RemoteObjectMethod;
023  use Zend\Code\Reflection\MethodReflection;
024  use ReflectionClass;
025   
026  /**
027   * Tests for {@see \ProxyManager\ProxyGenerator\RemoteObject\MethodGenerator\RemoteObjectMethod}
028   *
029   * @author Vincent Blanchon <blanchon.vincent@gmail.com>
030   * @license MIT
031   *
032   * @group Coverage
033   */
034  class RemoteObjectMethodTest extends PHPUnit_Framework_TestCase
035  {
036      /**
037       * @covers \ProxyManager\ProxyGenerator\RemoteObject\MethodGenerator\RemoteObjectMethod
038       */
039      public function testBodyStructureWithParameters()
040      {
041          $adapter = $this->getMock('Zend\\Code\\Generator\\PropertyGenerator');
042          $adapter->expects($this->any())->method('getName')->will($this->returnValue('adapter'));
043   
044          $reflectionMethod = new MethodReflection(
045              'ProxyManagerTestAsset\\BaseClass',
046              'publicByReferenceParameterMethod'
047          );
048   
049          $method = RemoteObjectMethod::generateMethod(
050              $reflectionMethod,
051              $adapter,
052              new ReflectionClass('Zend\\Code\\Generator\\PropertyGenerator')
053          );
054   
055          $this->assertSame('publicByReferenceParameterMethod', $method->getName());
056          $this->assertCount(2, $method->getParameters());
057          $this->assertSame(
058              '$return = $this->adapter->call(\'Zend\\\Code\\\Generator\\\PropertyGenerator\', '
059              . '\'publicByReferenceParameterMethod\', array($param, $byRefParam));'
060              . "\n\nreturn \$return;",
061              $method->getBody()
062          );
063      }
064   
065      /**
066       * @covers \ProxyManager\ProxyGenerator\RemoteObject\MethodGenerator\RemoteObjectMethod
067       */
068      public function testBodyStructureWithArrayParameter()
069      {
070          $adapter = $this->getMock('Zend\\Code\\Generator\\PropertyGenerator');
071          $adapter->expects($this->any())->method('getName')->will($this->returnValue('adapter'));
072   
073          $reflectionMethod = new MethodReflection('ProxyManagerTestAsset\\BaseClass', 'publicArrayHintedMethod');
074   
075          $method = RemoteObjectMethod::generateMethod(
076              $reflectionMethod,
077              $adapter,
078              new ReflectionClass('Zend\\Code\\Generator\\PropertyGenerator')
079          );
080   
081          $this->assertSame('publicArrayHintedMethod', $method->getName());
082          $this->assertCount(1, $method->getParameters());
083          $this->assertSame(
084              '$return = $this->adapter->call(\'Zend\\\Code\\\Generator\\\PropertyGenerator\', '
085              . '\'publicArrayHintedMethod\', array($param));'
086              . "\n\nreturn \$return;",
087              $method->getBody()
088          );
089      }
090   
091      /**
092       * @covers \ProxyManager\ProxyGenerator\RemoteObject\MethodGenerator\RemoteObjectMethod
093       */
094      public function testBodyStructureWithoutParameters()
095      {
096          $adapter = $this->getMock('Zend\\Code\\Generator\\PropertyGenerator');
097          $adapter->expects($this->any())->method('getName')->will($this->returnValue('adapter'));
098   
099          $reflectionMethod = new MethodReflection(__CLASS__, 'testBodyStructureWithoutParameters');
100   
101          $method = RemoteObjectMethod::generateMethod(
102              $reflectionMethod,
103              $adapter,
104              new ReflectionClass('Zend\\Code\\Generator\\PropertyGenerator')
105          );
106   
107          $this->assertSame('testBodyStructureWithoutParameters', $method->getName());
108          $this->assertCount(0, $method->getParameters());
109          $this->assertSame(
110              '$return = $this->adapter->call(\'Zend\\\Code\\\Generator\\\PropertyGenerator\', '
111              . '\'testBodyStructureWithoutParameters\', array());'
112              . "\n\nreturn \$return;",
113              $method->getBody()
114          );
115      }
116  }
117