News Feed
Sections




News Archive
feed this:

Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Rami Alnawas:
How to unit test code with Phalcon MVC Models
April 29, 2014 @ 11:57:39

Rami Alnawas has posted an interesting tutorial for the Phalcon users out there showing one way you can unit test your models. It's based on his own experience with the framework in a current project.

My first contribution to the PHP community in general, and Phalcon folks in particular, was the introduction of MVC Functional Testing with PHPUnit, this meant that Applications developed using Phalcon Framework could be unit tested by requesting a url then asserting that the response is handled by a specific action within the controller. [...] To date, my latest addition is an example of how to unit test code that utilises Phalcon models, mainly the various static find methods. The code is available on github and the coverage report is coveralls.io.

He shows it at work, creating a simple "Popup" model and a facade to help with making instances for testing. He also includes the code to test this facade, checking the results of methods like "fetchall", "select" and "execute".

0 comments voice your opinion now!
phalcon framework unit test coverage mvc model tutorial

Link: http://www.rami.me.uk/how-to-unit-test-code-with-phalcon-mvc-models

Codeception.com:
Getting on Testing Ship
June 13, 2013 @ 11:06:54

On the Codeception blog there's a new post that advocates getting on the testing ship even if the project you're currently on isn't using tests (or TDD).

In this blogpost we will try to figure out how to get faster into the testing. What tests to write at first? Let's say we already have a project and we didn't practice TDD/BDD developing it. Should we ignore testing at all? Definitely no. So where should we start then?

They suggest a three-tiered pyramid approach - UI at the top, Integration testing in the middle and Unit testing as the foundation. They talk about the times when testing doesn't make sense, like when your application is based on a third-party tool (like WordPress or Drupal). They recommend starting with functional testing and working your way back down, especially if your framework supports it. Obviously they encourage the use of Codeception for it, but also recommend even something like Selenium tests if nothing else.

0 comments voice your opinion now!
testing unit functional integration codeception skip

Link: http://codeception.com/06-12-2013/getting-on-testing-ship.html

Anna Filina:
Define Functional, Unit and Integration Tests
April 08, 2013 @ 14:45:46

Anna Filina has a new post to her site that helps to clarify the definitions between functional, unit and integrations tests of your application's functionality.

I have recently read a blog post claiming that functional tests are not "true" tests. The author also claims that unit testing shows you where the problem is occurring, while functional testing simply identifies that a problem exists. This argument is deceptive and the conclusion dangerous. Different kinds of tests are not mutually exclusive. One is not superior to the other. They have different goals and can happily coexist. Let me explain the kinds of tests so that you could make enlightened decisions.

She covers each type of test in detail, noting the goal of that particular type and some examples of the kinds of things they might test. She starts with the highest level, functional testing, then jumps down to the lowest - unit testing. She finishes up the post defining "integration tests" as tests that ensure you're integrating correctly - that you're using the API provided by the tool in the right way and that it's working as expected.

0 comments voice your opinion now!
testing functional unit integration definition example

Link: http://annafilina.com/blog/functional-unit-and-integration-tests

Chris Hartjes:
PHPSpec and the New Wave of Testing
October 19, 2012 @ 08:42:18

Chris Hartjes, a big proponent of testing in web applications (mostly in the PHP realm so far) has a new post to his site with some of his thoughts about PHPSpec, the specification-driven testing tool recently released by the same folks who made Behat.

I think that we are witnessing the first wave of new testing tools in the PHP community that allow developers to wrap their applications in automated tests. I am familiar with the BDD-style that is being promoted in PHPSpec, through my work with Behat to create automated user acceptance tests. I think if you want a tl;dr version of PHPSpec I would tell you "write hybrid unit/integration tests using plain language".

He notes that writing code to match a specification has similar concepts to using unit testing for TDD (with something like PHPUnit). He points out a few interesting things like the use of mock objects and the fact that you'll still need to write some code to make tests work - that's unavoidable right now.

0 comments voice your opinion now!
phpspec testing functional unit specification tdd


Codeception Blog:
Test WebServices With Codeception
June 20, 2012 @ 11:21:21

On the Codeception blog (an up and coming PHP-based testing tool) there's a new post showing how to use the tool to test your web services for either a SOAP or REST-based service.

Codeception testing framework got significant improvements during last week. The first and the major one is that you don't even need PEAR and Composer to execute tests. Only one file codecept.phar required. This might save your time and mind of your testers.

They've recently added modules for SOAP and REST support, making it easier to define your tests in a more fluid fashion. Included in the post are two examples, one REST and one SOAP. You can find more information about these new testing features over in the tool's documentation.

0 comments voice your opinion now!
webservices soap rest testing functional unit module


Volker Dusch's Blog:
The UNIT in unit testing
March 15, 2012 @ 08:24:03

Volker Dusch has a new post reminding us about what the "unit" part of "unit testing" means - small chunks of testable parts in an application.

What does the word UNIT in unit testing stand for? Think of an answer and read on! So? Did you say "A method! Because we test methods!"? If so let me offer another perspective.

He suggests that, rather than about just the methods in the class, it's more about testing the "observable behaviors" of the class. That is, anything that you could publicly use the class for and have something happen. He gives examples of this shift in focus - calling setValue and evaluating the result versus just calling the class property itself (then calling the method). He also includes a bit about testing behaviors - what happens when my script does [this] and how does that effect the overall class.

When your tests fail but the class "still works" and you need to "fix the tests" the your tests are worth a lot less as they don't really give you that cozy safety net that they should provide you with.
0 comments voice your opinion now!
unit unittesting opinion recommendation behavior method testable


PHPBuilder.com:
Create a Unit Conversion Application w/the Zend_Measure Component
February 15, 2010 @ 09:38:22

On PHPBulder.com there's a new tutorial posted showing you how to create an application that can do unit conversion with the help of the Zend_Measure component of the Zend Framework.

Performing even relatively simple conversion calculations such as from pounds to kilograms from memory can be fairly difficult, let alone calculating more esoteric conversions such as from square meters to acres. To automate this conversion process, I used the Zend Framework to create a calculator capable of easily migrating data among the most commonly used formats.

Zend_Measure lets you define the type you want to convert from and convert to based on some constants included with the component. A simple call to the "convertTo" method and you'll get your answer. Based on this he creates a simple calculator and shows you can can integrate roman numeral support in as well.

0 comments voice your opinion now!
unit convert zendframework zendmeasure tutorial


Symfony Project:
Book preview read the Unit Tests chapter
January 19, 2007 @ 11:44:00

With unit testing becoming more and more prevalent in development of online applications (especially PHP), it's good to see some of the frameworks giving their users as much information as possible. The symfony project has done just that as a part of a larger book on the framework.

You're probably curious to see if what we wrote in this book is really helpful and practical. So we decided to offer you a sample of the book, in PDF format, and that's precisely Chapter 15 about units and functional tests.

To check out this sample chapter from thei upcoming book (the chapter on unit testing), download it here or just grab 0 comments voice your opinion now!
symfony book sample chapter unit test apress framework symfony book sample chapter unit test apress framework


Matthew Weir O'Phinney's Blog:
Getting XDebug working with PHPUnit for code coverage reports
December 28, 2006 @ 15:02:00

After trying to get code coverage reports and unit testing with PHPUnit and XDebug to work, Matthew Weir O'Phinney succeeded and got the reports running. Fortunately, he's shared how he's done it and an example of how to run the report.

I've been playing with PHPUnit a lot of late, particularly with framework development. One thing that's always hard to determine is how well your code is exercised -- basically, how much of the code is tested in the unit tests?

He gives an "executive summary" of how to get XDebug working and playing nice with PHPUnit as well as something a bit more detailed, following his experience with getting things up and running.

0 comments voice your opinion now!
phpunit unit test xdebug codecoverage report phpunit unit test xdebug codecoverage report


Sebastian Bergmann's Blog:
AJAX-Based Test Runner for PHPUnit
November 22, 2006 @ 18:02:00

Sebastian Bergmann has posted an official call for help for a PHPUnit-related project that seems to be a more and more requested feature for the popular unit testing package - an Ajax-based test runner.

It would be great if the frontend for the browser-based test runner would make use of AJAX. Since I am clueless when it comes to both web design in general and AJAX in particular, I would appreciate if someone else could help me with implementing this test runner.

He's looking for the XHTML, CSS, and Javascript to put it all together as well as the Javascript that makes the magic happen. If you're interested in helping out, you can either contact him on the mailing list or in #phpunit on the Freenode IRC network.

0 comments voice your opinion now!
phpunit unit test ajax runner xhtml css javascript phpunit unit test ajax runner xhtml css javascript



Community Events





Don't see your event here?
Let us know!


podcast zendserver update opinion install list community tips release introduction library deployment interview symfony framework api package laravel series language

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework