2017 © Pedro Peláez
 

library unittest-generator

Generating PHP Unittest

image

tom-sapletta-com/unittest-generator

Generating PHP Unittest

  • Saturday, October 29, 2016
  • by tom-sapletta-com
  • Repository
  • 1 Watchers
  • 0 Stars
  • 5 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

PHP Unit Test Generator

About

With UnittestGenerator is possible create some part of file, but not all, beacue it is what must by defined by user, but i will try find some easy solution in the future, which can help with testing datatype and many methods. + files + class name + one method, (*1)

Article

https://tom.sapletta.com/project/a-tool-to-automatically-generate-phpunit-tests/, (*2)

Example

Configuration (in test.php)

$folder_project = 'src';
$folder_test = 'tests';
$namespace_project = 'Phunc';
$project_author = 'tom-sapletta-com';

$needle = ['interface', 'abstract'];
$files = new FilesGenerator($folder_project, $needle);

Usage

$result = new UnittestGenerator($files, $folder_test, $namespace_project, $project_author);

Start in Console

php test.php

Result in console, Summary

folder_test: tests
namespace_project: Phunc
project_author: tom-sapletta-com
FILE excluded:0
FILE scanned:0
FILE todo:4
FILE existing (not created):0
FILE TESTS created:4

+ tests\CreateSummaryTest.php

+ tests\FilesGeneratorTest.php

+ tests\TemplateTest.php

+ tests\UnittestGeneratorTest.php

Result Tests Files

CreateSummaryTest.php
FilesGeneratorTest.php
TemplateTest.php
UnittestGeneratorTest.php

Result in console, Summary when test file existing

folder_test: tests
namespace_project: Phunc
project_author: tom-sapletta-com
FILE excluded:0
FILE scanned:0
FILE todo:5
FILE existing (not created):5
FILE TESTS created:0

How it works

configuration data + set path_source for searching php classes + set path_test folder for tests + template for unit test, (*3)

find in path_source php files and get just classes: + no interface + no abstract + no functions, (*4)

generate files for test content in path_test folder show summary, (*5)

The Versions

29/10 2016

dev-master

9999999-dev https://github.com/tom-sapletta-com/unittest-generator

Generating PHP Unittest

  Sources   Download

MIT

The Requires

 

by Tomasz Sapletta

phpunit tests phpunit generator automatically tests