isidromerayo/simple_php_skeleton

Simple skeleton PHP project with Symfony2 components

Installs: 103

Dependents: 0

Suggesters: 0

Security: 0

Stars: 12

Watchers: 1

Forks: 1

pkg:composer/isidromerayo/simple_php_skeleton

v0.9.9.4 2015-01-27 19:39 UTC

README

A simple skeleton PHP project, using composer and modern PHP tools like PHPUnit

Latest version:

v0.9.9.4 2015-01-27 19:39 UTC Updated for PHP 8+ compatibility

requires

php: ^8.0 pimple/pimple: ^3.0 ext-curl: *

requires (dev)

phpunit/phpunit: ^9.6 mockery/mockery: ^1.5 phake/phake: ^4.0 ext-sqlite3: * phpunit/phpunit-selenium: ^9.0 facebook/webdriver: dev-community roave/security-advisories: dev-latest

suggests

ext-xdebug: Debugger and profiling ext-dom: Required for PHPUnit XML processing ext-mbstring: Required for various string operations ext-xml: Required for PHPUnit XML processing

Install

You need install composer (http://getcomposer.org/)

$ curl -s http://getcomposer.org/installer | php $ php composer.phar install

For development with all testing dependencies:

$ php composer.phar install --dev

If you install composer globally (http://getcomposer.org/doc/00-intro.md#globally), you should be use packagist :) (http://packagist.org/)

$ composer(.phar) create-project isidromerayo/simple_php_skeleton my_project_name

All-in-one install and check (inspired by https://gist.github.com/cordoval :)

$ curl -s https://raw.github.com/gist/3612021/272f75c0f8fe76008c6c2f4c124aa35d7182f728/simple_php_skeleton.sh | sh

Update

$ composer(.phar) update

Using

Create your test under "tests" directory. Create your code under "src" directory.

To run all tests

$ bin/phpunit -c tests

To run tests with code coverage (requires Xdebug)

$ bin/phpunit -c tests/phpunit-codecoverage.xml.dist

PHP Version Requirements

This project now requires PHP 8.0 or higher. The code has been modernized to work with:

  • PHP 8.0, 8.1, 8.2, 8.3
  • PHPUnit 9.6+
  • Modern dependency versions
  • Updated test syntax and configurations

Key Changes in PHP 8+ Update

  • Updated PHPUnit from 3.7.x to 9.6.x with modern syntax
  • Upgraded Pimple DI container to v3.x
  • Modernized test files to use new PHPUnit interfaces
  • Updated CI configuration for PHP 8.x versions
  • Replaced deprecated dependencies with modern alternatives

If you want to use ant (and only phpunit task)

$ ant phpunit

Too use code coverage you need install XDebug extension (http://xdebug.org/)

$ bin/phpunit -c tests/phpunit-codecoverage.xml.dist

$ ant -f build-composer.xml

The report for code coverage build/logs/junit.xml

All test

Require: WebDriver and add selenium server dependency and Java :) To add dependency into project:

$ composer(.phar) require edysanchez/selenium-server

By default minimal enviroment (unit + integration), to launch "complete" with Selenium the steps:

  1. Launch Selenium RC Server

$ bin/selenium-server.jar

  1. Launch test with custom configuration phpunit file (another terminal window)

$ bin/phpunit -c tests/phpunit-complete.xml.dist

You should remove "Acme" namespace ;)

Autotest

Note: Test on Ubuntu 12.04/14.04 (Gnome Shell and XFCE)

Guard PHPUnit2

You can try to autotest with Guard PHPUnit2

$ gem install guard-phpunit2

To launch, simple:

$ guard

The configuration file is Guardfile :)

More info https://github.com/ramon/guard-phpunit2

Travis-CI

Status build: Build Status

Scrutinizer

Quality: Scrutinizer Quality Score

Code Coverage: Code Coverage

Notes

[2026-01-26]

Major PHP 8+ Modernization:

  • Update PHP requirement from >=5.4.3 to ^8.0
  • Upgrade PHPUnit from 3.7.x to 9.6.x with modern syntax
  • Update Pimple DI container from 1.1.1 to ^3.0
  • Modernize all test files to use PHPUnit 9+ interfaces
  • Replace deprecated getMock() with createMock()
  • Update SimpleTestListener with new PHPUnit 9 signatures
  • Update all PHPUnit XML configurations for modern syntax
  • Upgrade CI configuration to test PHP 8.0-8.3
  • Replace sensiolabs/security-checker with roave/security-advisories
  • Update Scrutinizer configuration for modern tools
  • Add minimum-stability: dev for compatibility with modern packages
  • Add required PHP extensions documentation (dom, mbstring, xml, xmlwriter)

[2015-10-30]

Revised project:

  • Update doc
  • Remove hot-phpunit-runner (no works :()

[2015-01-27]

Remove selenium server, you should be add in composer.json dependency

"edysanchez/selenium-server": "dev-master",

To launch selenium server

bin/selenium-server.jar

[2013-11-24]

Test hot-phpunit-runner for autotest using PHP, try to remove guard-phpunit2

https://github.com/slavahatnuke/hot-phpunit-runner

hot/phpunit-runner dev-master requires php >=5.4.0, but skeleton_php_project requires >=5.3.3

[2013-11-19]

Example test doubles: Stubs and Mocks Add Selenium RC Server Listener to calculate time execution (https://gist.github.com/isidromerayo/5115136)

[2013-11-16]

Add template to Jenkins CI http://jenkins-php.org/

[2013-11-11]

Add basic Scrutinizer (https://scrutinizer-ci.com/).

[2013-10-10]

Add Phake (Test Doubles) to composer.json and autotest with Guard PHPUnit2 (gem).

[2013-10-09]

Script post install to remove .git

[2013-10-08]

Restructure to divide test into: unit, integration and functional

[2013-02-20]

Add "Security Advisories Checker" https://security.sensiolabs.org/

[2013-02-18]

Remove functional test because we need minimal enviroment to kata(yunos). Selenium RC will be another project (skeleton_PHP_testing)

[2012-12-19]

Change autoload to PSR-0 in src/ Reorganize phpunit.xml files and ant task

[2012-12-07]

Add Selenium RC and test demo

[2012-12-06]

Change vendor/bin to bin

Change "require" to "require-dev"

Add "suggest" to install XDebug

Update gist

[2012-10-07]

Add a Dependency Injection Container for PHP (Pimple)

http://pimple.sensiolabs.org/

References

PHPUnit:

http://phpunit.de/manual/current/en/index.html

Mockery:

https://github.com/padraic/mockery

Phake:

https://github.com/mlively/Phake
http://phake.digitalsandwich.com/docs/html/

Selenium Extension:

https://github.com/sebastianbergmann/phpunit-selenium/blob/master/Tests/Selenium2TestCaseTest.php