2017 © Pedro PelĆ”ez
 

library boot-tests

Bootstrap para os tests executados em ZF2 com PHPUnit

image

luk4z7/boot-tests

Bootstrap para os tests executados em ZF2 com PHPUnit

  • Friday, May 6, 2016
  • by luk4z7
  • Repository
  • 0 Watchers
  • 1 Stars
  • 12 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 7 Forks
  • 0 Open issues
  • 5 Versions
  • 50 % Grown

The README.md

BootTests

ConfiguraĆ§Ć£o no arquivo application.config.php, (*1)


return array( 'modules' => array( 'YourModulesInExecution' ), 'module_listener_options' => array( 'module_paths' => array( './module', './vendor', ), 'config_glob_paths' => array( 'config/autoload/{,*.}{global,local}.php', ), ), 'module_tests' => [ 'YourModulesForTests', 'Exemplo1', 'Exemplo2', 'Exemplo3' ] );

Estrutura de pastas para execuĆ§Ć£o dos tests, (*2)

YourModule
    config
    src
    tests
        src => yourTests
        Bootstrap.php => arquivo de inicializaĆ§Ć£o
        phpunit.xml => arquivo de configuraĆ§Ć£o dos tests
    db => pasta para instruƧƵes SQL
        create.sql
        drop.sql
    view
    Module.php

Arquivo de inicializaĆ§Ć£o do PHPUnit, (*3)

touch /var/www/yourproject/module/YourModule/tests/Bootstrap.php

namespace YourModule; require_once(getcwd() . '/../../../vendor/hiamina/son-base/src/BootTests/Test/AbstractBootstrap.php'); use BootTests\Test\AbstractBootstrap; error_reporting(E_ALL | E_STRICT); chdir(__DIR__); class Bootstrap extends AbstractBootstrap {} Bootstrap::init();

Arquivo de configuraĆ§Ć£o dos tests PHPUnit, (*4)

touch /var/www/yourproject/module/YourModule/tests/phpunit.xml

Para mais detalhes sobre a configuraĆ§Ć£o desse arquivo analisar na documentaĆ§Ć£o do PHPUnit DocumentaĆ§Ć£o phpunit.de, (*5)

<phpunit
    backupGlobals="false"
    backupStaticAttributes="false"
    bootstrap="Bootstrap.php"
    cacheTokens="false"
    colors="true"
    convertErrorsToExceptions="true"
    convertNoticesToExceptions="true"
    convertWarningsToExceptions="true"
    forceCoversAnnotation="false"
    mapTestClassNameToCoveredClassName="false"
    processIsolation="false"
    stopOnError="true"
    stopOnFailure="true"
    stopOnIncomplete="false"
    stopOnSkipped="false"
    timeoutForSmallTests="1"
    timeoutForMediumTests="10"
    timeoutForLargeTests="60"
    verbose="true">

    <!-- MUDAR O NOME DOS MODULOS -->
    <testsuites>
        <testsuite name="">
            <directory>./src/YourModule/Controller</directory>
            <directory>./src/YourModule/Filter</directory>
            <directory>./src/YourModule/Form</directory>
        </testsuite>
    </testsuites>

    <!-- CODE COVERAGE CONFIGURATION -->
    <filter>
        <whitelist>
            <directory suffix=".php">../</directory>
            <exclude>
                <file>../Module.php</file>
                <directory>../config</directory>
                <directory>../tests</directory>
            </exclude>
        </whitelist>
    </filter>

    <logging>
        <!-- COVERAGE == COBERTURA DE CODIGO -->
        <log type="coverage-html" target="_reports/coverage" title="" charset="UTF-8" yui="true" highlight="true" lowUpperBound="75" highLowerBound="90" />
        <log type="testdox-text" target="_reports/testdox/executed.txt" />
    </logging>
</phpunit>

ExecuĆ§Ć£o dos tests, (*6)

cd /var/www/yourproject/module/YourModule/tests/
php ../../../vendor/bin/phpunit (Pode ser executado de diversas maneiras, somente ilustrando uma das maneiras)

The Versions

06/05 2016

dev-master

9999999-dev

Bootstrap para os tests executados em ZF2 com PHPUnit

  Sources   Download

MIT

The Requires

 

by Lucas Alves

22/09 2015

1.0.3

1.0.3.0

Bootstrap para os tests executados em ZF2 com PHPUnit

  Sources   Download

MIT

The Requires

 

by Lucas Alves

12/02 2013

1.0.2

1.0.2.0 http://framework.zend.com

Base para modulos em ZF 2 da School of Net

  Sources   Download

MIT

The Requires

 

by Wesley Willians

zf2 module son

09/01 2013

1.0.0

1.0.0.0 http://framework.zend.com

Base para modulos em ZF 2 da School of Net

  Sources   Download

MIT

The Requires

 

by Wesley Willians

zf2 module son

09/01 2013

1.0.1

1.0.1.0 http://framework.zend.com

Base para modulos em ZF 2 da School of Net

  Sources   Download

MIT

The Requires

 

by Wesley Willians

zf2 module son