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

Laravel News:
Run PHPUnit Tests From Sublime Text
Dec 29, 2016 @ 15:30:48

On the Laravel News site they've posted a guide showing you how to setup and run PHPUnit tests from Sublime Text, one of the more popular editors for code development.

Sublime Text is a great editor. It’s lightweight, fast, and extremely customizable. However, one downside to it compared to a full blown IDE is it doesn’t come with support for running your PHPUnit tests directly from the test class you are working with.

To solve this problem, Adam Wathan created and released a free package named Sublime PHPUnit that allows you to run your tests from a keyboard shortcut. Let’s take a look at how to add this package to your arsenal.

The post walks you through the installation of the tool (manually cloning the repository) and how to then use it via Sublime's command palette. There's also some instruction on customizing the plugin's setup and allowing for shortcut keystrokes bound to events the plugin provides. The final tip helps you change the tool used to run the tests (the Terminal app by default) over to something like ITerm.

tagged: phpunit test unittest sublimetext editor plugin keystroke run

Link: https://laravel-news.com/sublime-phpunit

SitePoint PHP Blog:
Is It Possible to Write and Run PHP Code on an iPad?
Oct 25, 2016 @ 16:23:52

In this new tutorial from the SitePoint PHP blog Christopher Pitt once again takes on an unconventional question around the use of PHP: "is it possible to write/run PHP code on an iPad?"

I love the iPad. It’s a fantastic form factor for media consumption and gaming; and it also works well as an e-reader. The trouble is I don’t use it nearly as much as I could. Most of the time I’m consuming media (Netflix, Twitch, YouTube), I’m coding in parallel.

I can do that on my MacBook, but I’ve never been able to do that until now. [...] Today I’m going to show you how I code on an iPad. I won’t pretend it’s a perfect workflow (what workflow is?), but this is as exciting for me as the first time I used a laptop instead of a desktop.

He briefly covers some of the hardware you'll need to get started including a good keyboard you're comfortable with and a way to hook it up (either Bluetooth or manually via USB). He then gets into the software and mentions DraftCode and WorkingCopy as his tools of choice. He then helps you get started writing your first PHP script, using SQLite in-memory and using Working Copy to pull the latest code from your external source. Now that you're comfortable with the setup, he shows you how to install a Laravel application and the changes you'll need to make to get it up and running. Finally he shows the push of the code the remote source, updating the repository with these latest changes.

tagged: write run code ipad workingcopy draftcode laravel tutorial

Link: https://www.sitepoint.com/is-it-possible-to-write-and-run-php-code-on-an-ipad/

Sameer Borate:
Cron Expression Parser in PHP
Jul 21, 2015 @ 15:15:09

If you've ever worked with the "cron" tool on a unix-based system, you know that there's a special syntax that comes along with defining when the commands should run. It can be difficult to get this timing exactly right, especially if you're very picky about the execution time. In this post from Sameer Borate he shows you a PHP library that can help not only parse current cron configurations but also provides shortcuts for common timings (ex: "daily" or "weekly").

Working with cron scheduling can many times be a frustrating affair. Although setting a few cron jobs at one time can be easy, calculating cron dates in the future in code can get time consuming quickly. The PHP cron expression parser described here can parse a CRON expression, determine if it is due to run, calculate the next run date of the expression or calculate the previous run date of the expression. You can calculate dates far into the future or past by skipping n number of matching dates.

He includes some examples of putting the library to use to define a cron object based on an expression (either via a shortcut or an actual cron time expression). You can then check to see if the cron is "due" or perform some various operations about its run dates. This includes a formatted output of the previous run time, the next run time and the calculation of the next/previous run time based on a relative timestamp.

tagged: cron parser library example tutorial run due evaluation datetime

Link: http://www.codediesel.com/php/cron-expression-parser-in-php/

Warren Tang's Blog:
PHP Unit Testing & Mock Objects with SimpleTest plugin for Eclipse
Jun 17, 2011 @ 17:58:36

Warren Tang has put together this new post to his blog showing how you can use the SimpleTest extension for Eclipse to execute your tests without leaving the IDE.

He breaks it down into a few simple steps (some including screeshots):

  • Download the plugin
  • Install and configure
  • Create a basic test with an assertion
  • Run the test via "Run As > SimpleTest"

He also includes the option for running the test as a web page, but that requires a little bit more code. There's also a quick look at how to run a suite of tests from the IDE (as well as in the browser). for more about using SimpleTest, head over to the project's site.

tagged: unittest simpletest eclipse plugin configure run

Link:

Zoe Slattery's Blog:
Oh no! Not more tests!
Jul 09, 2009 @ 14:42:16

As Zoe Slattery mentions in her new post more testing for PHP is a good thing, but has come with a bit of a problem.

One of the problems with the incredible level of success of the PHP TestFest is that PHP gets more tests, 887 more to be precise. Well, isn't that the point? Yes, but it's beginning to take *forever* to run them which is a bad thing and as TestFests get bigger and better this will only get worse.

As a result, more work has been put into a project started a while back - a tool to allow more than one test to run at once (instead of linearly). This grab shows some of the resulting gains in speed. It jumps to about half to the time to make it through the ~7700 tests.

tagged: batch run performance unittest

Link:

Cal Evans' Blog:
Microsoft and PHP
May 06, 2009 @ 15:26:33

In some of his research into PHP and Windows recently, Cal Evans has come across two surprising things about the (usually dismissed) combination of the two:

  • It actually runs well if setup properly
    I don't have a spare computer so I'm not going to discuss performance or show benchmarks. I am talking about ease of use in getting things setup. [...] No, I'm not nearly ready to give up my Linux servers in production and despite Sam Ramji's recent pleas to their open source vendors not to compete on price but compete on value, I can still fail fast and cheap using open source software and operating systems.
  • A lot of open source developers just don't trust Microsoft, just because.
    I am, however, willing to give them the benefit of the doubt. I am part of the slim majority on the above poll who thinks they are sincere. The reason I am willing to give them the benefit of the doubt is not because I believe that the core of Microsoft has changed in any way [...] but because I believe that inside of Microsoft, there are pockets of brilliance.

Check out more of Cal's thoughts on the matter and the results of his "unscientific" polls he mentions in the rest of the post.

tagged: microsoft opinion combination windows run well trust

Link:

Richard Heyes' Blog:
An epiphany... (using cron)
Dec 26, 2007 @ 15:40:00

Richard Heyes has shared an epiphany he's come up with - a method for running scripts in a web-based environment using lynx.

OK maybe not to you, but it has just occurred to me, and things don't come to me all that fast these days. Cron jobs. [...] You can have a directory inside your webroot called "cron" (imaginative eh?) with scripts in there that are run via cron.

His method uses the cron daemon on the machine to invoke lynx and call the web page through its url. Of course, there are advantages and disadvantages of the method (including having the script open to the world - scary). Be sure to check out the comments for other suggestions from fellow developers.

tagged: cron lynx run script advantage disadvantage cron lynx run script advantage disadvantage

Link:

Richard Heyes' Blog:
An epiphany... (using cron)
Dec 26, 2007 @ 15:40:00

Richard Heyes has shared an epiphany he's come up with - a method for running scripts in a web-based environment using lynx.

OK maybe not to you, but it has just occurred to me, and things don't come to me all that fast these days. Cron jobs. [...] You can have a directory inside your webroot called "cron" (imaginative eh?) with scripts in there that are run via cron.

His method uses the cron daemon on the machine to invoke lynx and call the web page through its url. Of course, there are advantages and disadvantages of the method (including having the script open to the world - scary). Be sure to check out the comments for other suggestions from fellow developers.

tagged: cron lynx run script advantage disadvantage cron lynx run script advantage disadvantage

Link:

php|architect:
Introduction to PHPUnit
Aug 22, 2006 @ 12:26:39

On php|architect's A/R/T article repository today, there's a new guide written by Sebastian Bergmann - an introduction to PHPUnit.

In the last decade, PHP has developed from a niche language for adding dynamic functionality to small websites to a powerful tool making strong inroads into large-scale, business-critical Web systems. Financial institutions such as banks and insurance companies use PHP, for instance, to develop and maintain solutions for Basel II Credit Rating. Critical business logic like this needs to work correctly. But how do you ensure that it does? You test it, of course.

The tutorial takes a look at how to get started writing tests for your code and how to run those tests against your code to find problems. Sebastian also includes a few of the common misconceptions about unit testing, specifically using PHPUnit to test their apps.

tagged: introduction phpunit unit test tutorial create run misconceptions introduction phpunit unit test tutorial create run misconceptions

Link:

php|architect:
Introduction to PHPUnit
Aug 22, 2006 @ 12:26:39

On php|architect's A/R/T article repository today, there's a new guide written by Sebastian Bergmann - an introduction to PHPUnit.

In the last decade, PHP has developed from a niche language for adding dynamic functionality to small websites to a powerful tool making strong inroads into large-scale, business-critical Web systems. Financial institutions such as banks and insurance companies use PHP, for instance, to develop and maintain solutions for Basel II Credit Rating. Critical business logic like this needs to work correctly. But how do you ensure that it does? You test it, of course.

The tutorial takes a look at how to get started writing tests for your code and how to run those tests against your code to find problems. Sebastian also includes a few of the common misconceptions about unit testing, specifically using PHPUnit to test their apps.

tagged: introduction phpunit unit test tutorial create run misconceptions introduction phpunit unit test tutorial create run misconceptions

Link:


Trending Topics: