PHP Classes
elePHPant
Icontem

PHP Test Bed: Test PHP scripts describing what they execute

Recommend this page to a friend!

  Author Author  
Name: Natanael Simões <contact>
Classes: 4 packages by
Country: Brazil Brazil
Innovation award
Innovation award
Nominee: 1x

Winner: 1x


  Detailed description   Download Download .zip .tar.gz  
This package can be used to test PHP scripts describing what they execute.

It can take a given PHP script and processes it to describe what it would execute when it would be run for real.

The examples and documentation are in Portuguese but it also supports the English language.

In Portuguese:

Este componente é um executor de teste de mesa para scripts PHP.

Details

PhpTestBed v0.2.0

A técnica do teste de mesa ajuda programadores de qualquer nível a compreender melhor a lógica empregada ao verificar o fluxo e mudanças de estados de varíavel no decorrer da execução de um programa.

Esta biblioteca pretende realizar leitura de scripts PHP a fim de executar o teste de mesa informando ao usuário cada passo que será tomado pelo processador de script, do início até a conclusão da execução do script.

Ainda estamos em desenvolvimento inicial, por isso a quantidade de recursos da linguagem que são suportados são poucos.

Instalação

É necessário Composer para o gerenciamento das dependências.

$ git clone https://github.com/ifroariquemes/PHP-TestBed
$ cd PHP-TestBed
$ composer install

Exemplo de uso

Script de teste:

<?php

for($i = 1; $i <= 2; $i++) {
    echo $i + 1;
}

Saída:

Script iniciado
Linha 3: --- Entrou no laço FOR ---
Linha 3: A variável $i recebe o valor 1
Linha 3: A condição da estrutura retorna o valor true resultante da operação ($i <= 2) onde $i = 1
Linha 4: Imprime na tela o valor 2 resultante da operação ($i + 1) onde $i = 1
Linha 3: A variável $i tem seu valor incrementado para 2
Linha 3: A condição da estrutura retorna o valor true resultante da operação ($i <= 2) onde $i = 2
Linha 4: Imprime na tela o valor 3 resultante da operação ($i + 1) onde $i = 2
Linha 3: A variável $i tem seu valor incrementado para 3
Linha 3: A condição da estrutura retorna o valor false resultante da operação ($i <= 2) onde $i = 3
Linha 5: --- Saiu do laço FOR ---
Script finalizado

Comandos suportados

<table>

<tr>
    <td><b>Comando</b></td>
    <td><b>Incluso na versão</b></td>
</tr>
<tr>
	<td colspan="2">
		<b>Estruturas condicionais</b>
	</td>
</tr>
<tr>
	<td>If-Else</td>
	<td>v0.1.0</td>
</tr>
    <tr>
	<td>Switch-Case-Default</td>
	<td>v0.2.0</td>
</tr>

<tr>

<td colspan="2"><b>Laços de repetição</b></td>

</tr>

<tr>
<td>For</td>
<td>v0.1.0</td>
</tr>
<tr>    
<td>Foreach</td>
<td>v0.2.0</td>
</tr>
<tr>
<td>While</td>
<td>v0.1.0</td>
</tr>
<tr>
<td>Do-While</td>
<td>v0.1.0</td>
</tr>
<tr>
<td colspan="2"><b>Operações aritméticas</b></td>

</tr>

<tr>
<td>Soma (`+`)</td>
<td>v0.1.0</td>
</tr>
<tr>
<td>Subtração (`-`)</td>
<td>v0.1.0</td>
</tr>
<tr>
<td>Multiplicação (`*`)</td>
<td>v0.1.0</td>
</tr>
<tr>
<td>Divisão (`/`)</td>
<td>v0.1.0</td>
</tr>
<tr>
<td>Resto da divisão (`%`)</td>
<td>v0.1.0</td>
</tr>
<tr>
<td>Deslocamento binário (`&lt;&lt;` e `&gt;&gt;`)</td>
<td>v0.1.0</td>
</tr>
<tr>
<td>Incrementação (`++`)</td>
<td>v0.1.0 (posterior)<br>v0.2.0(anterior)</td>
</tr>
<tr>
<td>Decrementação (`--`)</td>
<td>v0.2.0</td>
</tr>
<tr>
<td colspan="2"><b>Operações lógicas</b></td>
</tr>
<tr>
<td>Booleano E (`&amp;&amp;`)</td>
<td>v0.1.0</td>
</tr>
<tr>
<td>Booleano OU (`||`)</td>
<td>v0.1.0</td>
</tr>
<tr>
<td>Bitwise E (`&amp;`)</td>
<td>v0.1.0</td>
</tr>
<tr>
<td>Bitwise OU (`|`)</td>
<td>v0.1.0</td>
</tr>
<tr>
<td>Bitwise OU EXCLUSIVO (`^`)</td>
<td>v0.1.0</td>
</tr>
<tr>
<td colspan="2"><b>Operações relacionais</b></td>
</tr>
<tr>	
<td>Igual (`==`)</td>
<td>v0.1.0</td>
</tr>
<tr>	
<td>Idêntico (`===`)</td>
<td>v0.1.0</td>
</tr>
<tr>	
<td>Diferente (`!=`)</td>
<td>v0.1.0</td>
</tr>
<tr>	
<td>Não idêntico (`!==`)</td>
<td>v0.1.0</td>
</tr>
<tr>	
<td>Maior (`&gt;`)</td>
<td>v0.1.0</td>
</tr>
<tr>	
<td>Maior ou igual (`&gt;=`)</td>
<td>v0.1.0</td>
</tr>
<tr>	
<td>Menor (`&lt;`)</td>
<td>v0.1.0</td>
</tr>
<tr>	
<td>Menor ou igual (`&lt;=`)</td>
<td>v0.1.0</td>
</tr>
<tr>	
<td>Nave espacial (`&lt;=&gt;`)</td>
<td>v0.1.0</td>
</tr>	
<tr>
<td colspan="2"><b>Outros</b></td>
</tr>
<tr>	
<td>Echo</td>
<td>v0.1.0</td>
</tr>
<tr>
<td>Atribuição (`=`)</td>
<td>v0.1.0</td>
</tr>
<tr>
<td>Concatenação (`.`)</td>
<td>v0.1.0</td>
</tr>
<tr>
<td>Global</td>
<td>v0.2.0</td>
</tr>
<tr>
<td>Parada (`break`)</td>
<td>v0.2.0</td>
</tr>
<tr>
<td>Constantes</td>
<td>v0.2.0 (`const`)<br>em breve (`define`)</td>
</tr>
<tr>
<td>Vetores e Matrizes (`array()` e `[]`)</td>
<td>v0.2.0</td>
</tr>
<tr>
<td>Try-Catch-Finally</td>
<td>v0.2.0</td>
</tr>
<tr>
<td>Throw</td>
<td>v0.2.0</td>
</tr>
</table>

Contribua!

Ajude-nos a fazer esse software dar certo. Veja em milestones que funções essa biblioteca ainda precisa implementar. Ou então revise o que já existe para continuar melhorando a qualidade e desempenho.

Licença Creative Commons

Este trabalho está licenciado com uma Licença Creative Commons - Atribuição 4.0 Internacional


  Classes of Natanael Simões  >  PHP Test Bed  >  Download Download .zip .tar.gz  >  Support forum Support forum  >  Blog Blog  >  RSS 1.0 feed RSS 2.0 feed Latest changes  

 

Name: PHP Test Bed
Base name: php-testbed
Description: Test PHP scripts describing what they execute
Version: -
PHP version: 5
License: MIT/X Consortium License
 
  Groups   Applications   Files Files  

  Groups  
Group folder image PHP 5 Classes using PHP 5 specific features View top rated classes
Group folder image Language Constructs to assist in the language control View top rated classes
Group folder image Testing Tools to help verifying that software works as expected View top rated classes


  Applications that use this package  
No pages of applications that use this class were specified.

Add link image If you know an application of this package, send a message to the author to add a link here.

  Files folder image Files  
File Role Description
Files folder imageapp (1 directory)
Files folder imagesrc (4 files, 3 directories)
Files folder imagetests (2 files, 1 directory)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file composer.lock Data Auxiliary data
Accessible without login Plain text file index.php Example Example script
Accessible without login Plain text file LICENSE.md Lic. License text
Accessible without login Plain text file README.md Doc. Documentation
Accessible without login Plain text file test.php Aux. Auxiliary script
Accessible without login Plain text file _config.yml Data Auxiliary data

  Files folder image Files  /  app  
File Role Description
Files folder imagecss (1 file)

  Files folder image Files  /  app  /  css  
File Role Description
  Accessible without login Plain text file style.css Data Auxiliary data

  Files folder image Files  /  src  
File Role Description
Files folder imageLang (2 directories)
Files folder imageNode (8 files, 3 directories)
Files folder imageScriptCrawler (1 file)
  Plain text file I18n.php Class Class source
  Plain text file Repository.php Class Class source
  Plain text file ScriptCrawler.php Class Class source
  Plain text file Stylizer.php Class Class source

  Files folder image Files  /  src  /  Lang  
File Role Description
Files folder imageen (1 file)
Files folder imagept_BR (1 file)

  Files folder image Files  /  src  /  Lang  /  en  
File Role Description
  Accessible without login Plain text file app.yml Data Auxiliary data

  Files folder image Files  /  src  /  Lang  /  pt_BR  
File Role Description
  Accessible without login Plain text file app.yml Data Auxiliary data

  Files folder image Files  /  src  /  Node  
File Role Description
Files folder imageExpr (10 files, 2 directories)
Files folder imageScalar (5 files)
Files folder imageStmt (14 files)
  Plain text file NodeBaseAbstract.php Class Class source
  Plain text file NodeBaseInterface.php Class Class source
  Plain text file NodeExprAbstract.php Class Class source
  Plain text file NodeExprInterface.php Class Class source
  Plain text file NodeLoader.php Class Class source
  Plain text file NodeScalarAbstract.php Class Class source
  Plain text file NodeUsableAbstract.php Class Class source
  Plain text file NodeUsableInterface.php Class Class source

  Files folder image Files  /  src  /  Node  /  Expr  
File Role Description
Files folder imageAssignOp (13 files)
Files folder imageBinaryOp (28 files)
  Plain text file ArrayDimFetch.php Class Class source
  Plain text file Array_.php Class Class source
  Plain text file Assign.php Class Class source
  Plain text file ConstFetch.php Class Class source
  Plain text file PostDec.php Class Class source
  Plain text file PostInc.php Class Class source
  Plain text file PreDec.php Class Class source
  Plain text file PreInc.php Class Class source
  Plain text file Ternary.php Class Class source
  Plain text file Variable.php Class Class source

  Files folder image Files  /  src  /  Node  /  Expr  /  AssignOp  
File Role Description
  Plain text file BitwiseAnd.php Class Class source
  Plain text file BitwiseOr.php Class Class source
  Plain text file BitwiseXor.php Class Class source
  Plain text file Concat.php Class Class source
  Plain text file Div.php Class Class source
  Plain text file Minus.php Class Class source
  Plain text file Mod.php Class Class source
  Plain text file Mul.php Class Class source
  Plain text file NodeAssignOpAbstract.php Class Class source
  Plain text file Plus.php Class Class source
  Plain text file Pow.php Class Class source
  Plain text file ShiftLeft.php Class Class source
  Plain text file ShiftRight.php Class Class source

  Files folder image Files  /  src  /  Node  /  Expr  /  BinaryOp  
File Role Description
  Plain text file BitwiseAnd.php Class Class source
  Plain text file BitwiseOr.php Class Class source
  Plain text file BitwiseXor.php Class Class source
  Plain text file BooleanAnd.php Class Class source
  Plain text file BooleanOr.php Class Class source
  Plain text file Coalesce.php Class Class source
  Plain text file Concat.php Class Class source
  Plain text file Div.php Class Class source
  Plain text file Equal.php Class Class source
  Plain text file Greater.php Class Class source
  Plain text file GreaterOrEqual.php Class Class source
  Plain text file Identical.php Class Class source
  Plain text file LogicalAnd.php Class Class source
  Plain text file LogicalOr.php Class Class source
  Plain text file LogicalXor.php Class Class source
  Plain text file Minus.php Class Class source
  Plain text file Mod.php Class Class source
  Plain text file Mul.php Class Class source
  Plain text file NodeBinaryOpAbstract.php Class Class source
  Plain text file NotEqual.php Class Class source
  Plain text file NotIdentical.php Class Class source
  Plain text file Plus.php Class Class source
  Plain text file Pow.php Class Class source
  Plain text file ShiftLeft.php Class Class source
  Plain text file ShiftRight.php Class Class source
  Plain text file Smaller.php Class Class source
  Plain text file SmallerOrEqual.php Class Class source
  Plain text file Spaceship.php Class Class source

  Files folder image Files  /  src  /  Node  /  Scalar  
File Role Description
  Plain text file DNumber.php Class Class source
  Plain text file Encapsed.php Class Class source
  Plain text file EncapsedStringPart.php Class Class source
  Plain text file LNumber.php Class Class source
  Plain text file String_.php Class Class source

  Files folder image Files  /  src  /  Node  /  Stmt  
File Role Description
  Plain text file Break_.php Class Class source
  Plain text file Const_.php Class Class source
  Plain text file Do_.php Class Class source
  Plain text file Echo_.php Class Class source
  Plain text file ElseIf_.php Class Class source
  Plain text file Foreach_.php Class Class source
  Plain text file For_.php Class Class source
  Plain text file Global_.php Class Class source
  Plain text file If_.php Class Class source
  Plain text file Nop.php Class Class source
  Plain text file Switch_.php Class Class source
  Plain text file Throw_.php Class Class source
  Plain text file TryCatch.php Class Class source
  Plain text file While_.php Class Class source

  Files folder image Files  /  src  /  ScriptCrawler  
File Role Description
  Plain text file Options.php Class Class source

  Files folder image Files  /  tests  
File Role Description
Files folder imageNode (1 directory)
  Accessible without login Plain text file bootstrap.php Aux. Auxiliary script
  Plain text file TestCase.php Class Class source

  Files folder image Files  /  tests  /  Node  
File Role Description
Files folder imageExpr (1 directory)

  Files folder image Files  /  tests  /  Node  /  Expr  
File Role Description
Files folder imageAssign (2 files)

  Files folder image Files  /  tests  /  Node  /  Expr  /  Assign  
File Role Description
  Accessible without login Plain text file AssignSource.php Aux. Auxiliary script
  Plain text file AssignTest.php Class Class source

Download Download all files: php-testbed.tar.gz php-testbed.zip
NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.