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

Adam Wathan:
Detecting Out of Sync Mocks in Mockery
Apr 05, 2017 @ 16:14:41

Adam Wathan has shared a new post on his site with advice on finding out-of-date mocks when using the Mockery mocking tool in your testing.

If you're not careful, it's easy to find yourself in a situation where a test double has gotten out of sync with the actual class or interface it's mocking.

In this quick screencast (taken from my Test-Driven Laravel course), I walk through how I use a little-known Mockery feature to help track down these issues and make sure I'm not mocking methods that don't exist.

The quick screencast (about 4 minutes) gives an example of locating the issue when a "Ticket" class is refactored. While the tests still pass, it can cause issues in testing and can be difficult to find. Mockery comes with a configuration option (in 1.0 alpha) to disable the mocking of methods that don't exist on the original object. He shows how to disable this feature and what the resulting error looks like when the tests are run.

tagged: mockery screencast unittest mock sync class disable configuration

Link: https://adamwathan.me/2017/04/03/detecting-out-of-sync-mocks-in-mockery/

Amazon Web Services PHP Blog:
Syncing Data with Amazon S3
Jun 28, 2013 @ 16:57:59

On the Amazon AWS blog there's a recent post showing you how to sync data with S3 and handle multiple files quickly and easily.

Have you ever needed to upload an entire directory of files to Amazon S3 or download an Amazon S3 bucket to a local directory? With a recent release of the AWS SDK for PHP, this is now not only possible, but really simple.

He includes example code for doing it both ways - upload and download syncing - as well as some options you can use to customize the connection. You can define things like ACL settings, the number of concurrent connections and if you want the debug options turned off or on.

tagged: sync amazon s3 tutorial upload download

Link: http://blogs.aws.amazon.com/php/post/Tx2W9JAA7RXVOXA/Syncing-Data-with-Amazon-S3

SitePoint PHP Blog:
How To Synchronize Your PHP and MySQL Timezones
Apr 20, 2011 @ 16:52:50

In a new post to the SitePoint PHP blog today Craig Buckler looks at a method for synchronizing your time between your PHP application and it's MySQL backend to make date handling a bit easier - no messy code-based timezone changes needed.

Many developers solve the problem by shifting all date/time responsibility to PHP. They may also convert dates to Unix timestamp integers for simpler handling, although you should be wary of the Y2K38 Bug.

They show a handy tip so you won't have to worry quite so much that relies on setting a "TIMEZONE" constant you can use to set the default timezone and a "time_zone" offset that can be used each time you make the connection to your database (or, alternatively, in a cron that keeps things up to date without interfering with performance).

tagged: timezone sync mysql database offset

Link:

Juozas Kaziukenas's Blog:
Using Phing to sync files with shared hosting
Mar 02, 2009 @ 19:41:12

Juozas Kaziukenas has a new post to his blog today looking at using Phing to keep files in sync on a shared hosting, FTP only kind of environment.

Today I was trying to use [Phing] in shared hosting server, but as you will see, Phing can’t do a lot of it’s functionality without direct access to server (over shh for example). [...] Things get worse, when you try to sync files in shared hosting environment, where only FTP is available. [...] Code in the hole some months ago posted solution which uses Net_FTP (FTP functionality wrapper) package to upload files to server. I decided to try given solution, so I modified it to download source code from SVN first and then upload them.

His Phing configuration sets up the application, defining the source directory, the files to push, the FTP connection to make and pushes the files over out of an svn export. He has a slightly different solution (no code/config for this one) that would grab the last revision value from the remote server and only push out the files have have changed since then.

tagged: phing sync files shared hosting ftp subversion svn source configuration

Link:

Joshua Eichorn's Blog:
Pear Mirror
Mar 28, 2007 @ 15:19:00

Joshua Eichorn has posted a quick note about a new addition to the PEAR functionality (with some help from Greg Beaver) - hosting a mirror of the main PEAR channel.

At the moment were only mirroring installer data not the entire website but its a start. Things are still in the testing phase, but the mirror is usable, just run: pear config-set preferred_mirror us.pear.php.net

The update runs every four hours, so thing might be a little out of sync sometimes, but if you're just looking to keep things up-to-date, that's more than enough.

tagged: pear mirror hosting channel sync update pear mirror hosting channel sync update

Link:

Joshua Eichorn's Blog:
Pear Mirror
Mar 28, 2007 @ 15:19:00

Joshua Eichorn has posted a quick note about a new addition to the PEAR functionality (with some help from Greg Beaver) - hosting a mirror of the main PEAR channel.

At the moment were only mirroring installer data not the entire website but its a start. Things are still in the testing phase, but the mirror is usable, just run: pear config-set preferred_mirror us.pear.php.net

The update runs every four hours, so thing might be a little out of sync sometimes, but if you're just looking to keep things up-to-date, that's more than enough.

tagged: pear mirror hosting channel sync update pear mirror hosting channel sync update

Link:


Trending Topics: