PHP Classes

File: tests/TestRegistration/AnnotationTestDisabled.php

Recommend this page to a friend!
  Packages of Thierry Feuzeu   Jaxon   tests/TestRegistration/AnnotationTestDisabled.php   Download  
File: tests/TestRegistration/AnnotationTestDisabled.php
Role: Class source
Content type: text/plain
Description: Class source
Class: Jaxon
Call PHP classes from JavaScript using AJAX
Author: By
Last change:
Date: 1 year ago
Size: 1,220 bytes
 

Contents

Class file image Download
<?php

namespace Jaxon\Tests\TestRegistration;

require dirname(__DIR__, 1) . '/src/annotated.php';
require dirname(__DIR__, 1) . '/src/excluded.php';

use Jaxon\Jaxon;
use Jaxon\Exception\SetupException;
use Jaxon\Utils\Http\UriException;
use PHPUnit\Framework\TestCase;

use Annotated;
use Excluded;

use function Jaxon\Annotations\_register;

class AnnotationTestDisabled extends TestCase
{
    /**
     * @throws SetupException
     */
    public function setUp(): void
    {
        _register();

        jaxon()->config()->load(__DIR__ . '/../config/annotations.php');

        jaxon()->register(Jaxon::CALLABLE_CLASS, Annotated::class);
        jaxon()->register(Jaxon::CALLABLE_CLASS, Excluded::class);
    }

    /**
     * @throws SetupException
     */
    public function tearDown(): void
    {
        jaxon()->reset();
        parent::tearDown();
    }

    /**
     * @throws UriException
     */
    public function testJsCode()
    {
        $sJs = jaxon()->getScript();

        $this->assertStringContainsString("upload: 'user-files'", $sJs);
        $this->assertStringContainsString('bags: ["user.name","page.number"]', $sJs);
        $this->assertStringNotContainsString('Excluded', $sJs);
    }
}