"Fossies" - the Fresh Open Source Software Archive

Member "contao-4.4.48/core-bundle/tests/Framework/Adapter/AdapterTest.php" (2 Apr 2020, 1054 Bytes) of package /linux/www/contao-4.4.48.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 <?php
    2 
    3 /*
    4  * This file is part of Contao.
    5  *
    6  * (c) Leo Feyer
    7  *
    8  * @license LGPL-3.0-or-later
    9  */
   10 
   11 namespace Contao\CoreBundle\Tests\Framework\Adapter;
   12 
   13 use Contao\CoreBundle\Framework\Adapter;
   14 use Contao\CoreBundle\Tests\Fixtures\Adapter\LegacyClass;
   15 use PHPUnit\Framework\TestCase;
   16 
   17 /**
   18  * Tests the Adapter class.
   19  *
   20  * @author Yanick Witschi <https://github.com/toflar>
   21  */
   22 class AdapterTest extends TestCase
   23 {
   24     /**
   25      * Tests the __call method.
   26      */
   27     public function testImplementsTheMagicCallMethod()
   28     {
   29         /** @var LegacyClass $adapter */
   30         $adapter = new Adapter(LegacyClass::class);
   31 
   32         $this->assertSame(['staticMethod', 1, 2], $adapter->staticMethod(1, 2));
   33     }
   34 
   35     /**
   36      * Tests the __call method of a non-existent function.
   37      */
   38     public function testFailsIfAMethodDoesNotExist()
   39     {
   40         $adapter = new Adapter(LegacyClass::class);
   41 
   42         $this->expectException('PHPUnit_Framework_Error');
   43 
   44         /* @noinspection PhpUndefinedMethodInspection */
   45         $adapter->missingMethod();
   46     }
   47 }