Added By: Feedage Forager Feedage Grade B rated
Language: English
code coverage  code  data  database  factory  fix  laravel news  laravel  latest  length  new  news  part  testing  toy  validation  vue 
Rate this Feed
Rate this feedRate this feedRate this feedRate this feedRate this feed
Rate this feed 1 starRate this feed 2 starRate this feed 3 starRate this feed 4 starRate this feed 5 star

Comments (0)

Feed Details and Statistics Feed Statistics

Up-to-the Minute PHP News, views and community

Published: Thu, 22 Feb 2018 07:31:19 -0600


That Podcast: Episode 47: The One Where Silex Is Dead

Wed, 21 Feb 2018 10:44:50 -0600

That Podcast, with hosts and PHP community members Beau Simensen and Dave Marshall, have posted their latest episode (#47): The One Where Silex Is Dead

In this new show Beau and Dave are joined by guest Kevin Boyd to talk about the death of the previously popular Silex framework and how it is being sunsetted by the release of Symfony 4 and Flex. Other topics mentioned include:

You can listen to this latest episode either using the in-page audio player or by downloading the mp3 directly. If you enjoy the show, be sure to subscribe to their feed and follow them on Twitter to get updates when new shows are released.

Laravel News: Testing Length Validation in Laravel

Wed, 21 Feb 2018 09:54:40 -0600

On the Laravel News site there's a new post that gets into detail about length testing in Laravel. This testing evaluates the length of the text data taken in as input from some outside source (usually user input).

I thought it might help people new to the Laravel framework and testing, to walk through how to test length validation. When I say length validation, I mean the constraints of length that you might want to put on a string field.

[...] When testing lengths, there are a couple of techniques I think can be helpful that I use with HTTP tests to verify that my validation is working as expected. Let’s walk through some hands-on examples of the validation portion of a controller request; we will also need a test database to demonstrate a test that interacts with a database.

They start by creating a new Laravel project and adding in some basic "user" functionality to store them in a local SQLite database. It then shows the code required to validate the incoming data on the "store" method including the "max" validation handling on the email address. It then shifts over to the actual testing of the validation, writing checks to ensure the maximum length is enforced with a random string, doing the same with an email address and handling cases of multiple validation tests.

Community News: Recent posts from PHP Quickfix (02.21.2018)

Wed, 21 Feb 2018 08:05:02 -0600

Recent posts from the PHP Quickfix site:

Community News: Latest PECL Releases (02.20.2018)

Tue, 20 Feb 2018 08:05:02 -0600

Latest PECL Releases:

  • ssdeep 1.1.0
    * Patch for PHP 7 support (remicollet)

    • Add basic Windows support (weltling)
  • apcu_bc 1.0.4
    - promote as stable (no change)
  • APCu 5.1.10
    - fix gh#247 when a NUL char is used as key, apcu_fetch(array) truncates the key - fix gh#248 apcu_fetch may return values causing zend_mm_corruption or segfaults when custom serializer is used - fix gh#260 apcu.serializer=default results in segfault - fix gh#274 non-portable shell == in config.m4 - fix crash when passing bad array to apcu_delete - improve fix gh#266 refcounting errors in APCIterator - fix for PHP 7.3 compatibility Understanding Design Patterns - Simple Factory

Mon, 19 Feb 2018 12:38:43 -0600

On the site, they've posted the latest in their article series covering design patterns and their implementation in PHP. In this latest tutorial they cover the simple factory pattern. To help illustrate the point of the pattern they use an example of a toy company with an ever-expanding line of toys.

Dragon Inc. is one of the top toy manufacturers in China. In fact, they're a pioneer in toy manufacturing. They started production at a time when few toys were being produced commercially. Hence, they dominated the market and became the leader in the toy production industry.

The initial version of their produceToy method only had to worry about toy cars and helicopters. As their line expanded, it needed to be updated for "jumping frogs" too. Adding each new toy to the single function would be difficult to maintain but the simple factory pattern came to the rescue. It allowed for the abstraction of the toy object creation out to other handling and other objects, breaking the functionality up in accordance with the Single Responsibility Principle.

Laravel News: Building a Vue SPA with Laravel Part 3

Mon, 19 Feb 2018 11:22:08 -0600

The Laravel News site is back with the latest part in their series covering the combination of Laravel and Vue to create a basic application. In this latest part (part 3) they continue from the previous tutorials and show how to pull in real data versus the fake data from before.

We will continue building our Vue SPA with Laravel by showing you how to load asynchronous data before the vue-router enters a route.

We left off in Building a Vue SPA With Laravel Part 2 finishing a UsersIndex Vue component which loads users from an API asynchronously. We skimped on building a real API backed by the database and opted for fake data in the API response from Laravel’s factory() method.

If you haven’t read Part 1 and Part 2 of building a Vue SPA with Laravel, I suggest you start with those posts first and then come back. I’ll be waiting for you!

In this tutorial, we are also going to swap out our fake /users endpoint with a real one powered by a database.

They get immediately back to the code, creating a "user" table seeder to generate randomized data and adding it for execution. Next, they switch to the database side, creating the MySQL database for the user data and running the seeding to create the users. The tutorial then shows the creation of the Users controller and what the resulting JSON will look like when pulling all users. Finally, it moves out to the client side and shows how to pull in the data pre-load and push the user details into a template to be rendered.

Nikola Poša: Factory as a Service

Mon, 19 Feb 2018 10:53:16 -0600

In a post to his site Nikola Poša looks at a method that can be used to provide a slightly different object from a dependency injection container based on other criteria: making use of a factory as a service.

Dependency Injection Containers are a great invention - when used the right way, they allow us to keep our factories and assembly logic of services outside the core business logic of our application.

By default, a service created is shared, meaning that exactly the same instance will be returned whenever service is retrieved from a container. This is a desired behaviour in most of the cases. [...] Yet certain use cases may require services to be created conditionally during runtime, such as for example based on the value of a parameter resolved from the current request.

He first covers some of the anti-patterns that could be used to resolve this issue: a setter method on the returned object, using a service manager or creating a static factory instead. He offers a solution to the problem that makes use of a factory inside of the DI container. This factory then uses configuration values from the container to set up the object and return it.

Alejandro Celaya: Mutation testing with infection in big PHP projects

Mon, 19 Feb 2018 09:39:58 -0600

Alejandro Celaya has a post on his site that shows how to use a less well-known testing tool - mutation testing - to test for variations on the "good" and "bad" data paths. In this article he makes use of the infection library that replaced the previously active Humbug library.

There's no doubt that having tests in a project allows you to find potential bugs earlier and more easily.

Lots of OSS projects require a minimum code coverage in order to accept new pull requests from contributors, and proprietary projects also tend to have some sort of continuous integration workflow which requires certain metrics to be fulfilled in order to get builds passing. However, the code coverage can lead to a false sense of security, which makes you think that if a certain class has a 100% code coverage, it is also 100% bug-free.

This is not always true since you could be calling a method and yet not being properly testing its output or its real behavior. The code coverage will mark it as covered, but you might introduce a bug and still have a green test. This is where mutation testing comes in.

He starts by briefly introducing the concepts of mutation testing and showing how to get the infection library installed and configured. He then gives a guide on running the tool and some of the command line options that can be used to configure threading, having it only run on covered code and setting the log verbosity. He then offers some advice on troubleshooting the use of the tool and how phpdbg is used to generate reports.

Three Devs & A Maybe: Build, Provision and Deploy in the Cloud with Thijs Feryn

Fri, 16 Feb 2018 11:31:13 -0600

The Three Devs and a Maybe podcast, with hosts Michael Budd, Fraser Hart, Lewis Cains and Edd Mann, has posted their latest episode with special guest Thijs Feryn talking about the build/provision/deploy pipeline "in the cloud".

In this weeks episode we are joined by Thijs Feryn to discuss his upcoming PHP UK conference talk. We start of the show highlighting what drew him to a Tech. evangelist role, bridging the gap between code/infrastructure and the ideas behind ‘Infrastructure as Code’. From here we move on to discuss system and infrastructure provisioning automation tools such Ansible and Terraform. This leads on to adding Packer into the mix, moving towards immutable infrastructure, testing these automation tools and how history has a way of repeating itself. Finally, we touch upon the philosophy behind DevOps, focusing on empathy and its core values CAMS.

You can listen to this latest episode either by using the in-page audio player or by downloading the mp3 directly. If you enjoy the show, be sure to subscribe to their feed and follow them on Twitter for updates when new shows are released.