Friday, April 28, 2017

Upgrading Sylius the TDD Way: Exploring PhpSpec

The post on developing and testing new Sylius features was an introduction to the three types of tests that are used in Sylius - PHPUnit, Phpspec and Behat.

In this part, we'll extend some core classes to indicate color-coded inventory status. First, we'll deal with the back end part. In a followup post, we'll use Behat and test the visual changes. Please follow the instructions in the previous post to get a working instance up and running.


Sylius logo

Sylius has an excellent inventory management solution. However, there's always some room for a tweak or two. If you look at the list of products (admin/products) there's no information about available stock. Looking at the variants of a product, we see inventory data, whether it's tracked or not, and the number of total items in stock, if tracked. It would be nice to see that kind of information on the product listing page, too. In addition, the stock level is all or nothing - for example, a green label says "10 Available on hand" or red "0 Available on hand". How about something in-between, say a yellow label for "3 Available on hand" to indicate that stock is low? Then, the store admin can decide it's time to replenish.

Extend ProductVariant and Product models

We want to extend the behavior of both the ProductVariant and Product models provided by Sylius, so we can see extra information on stock availability when viewing products.

Create a Bundle

First, we create the src/AppBundle/AppBundle.php file and register it in app/AppKernel.php.

<?php

// src/AppBundle/AppBundle.php

namespace AppBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class AppBundle extends Bundle
{
}

<?php

// app/AppKernel.php

public function registerBundles()
{
    $bundles = [
        // ...
        new AppBundle\AppBundle(),
    ];
}

Next, we inform the autoloader about the new bundle by adding it to the "autoload" section of composer.json.

Continue reading %Upgrading Sylius the TDD Way: Exploring PhpSpec%


by Deji Akala via SitePoint

#332: TypeScript 2.3 Released

This week's JavaScript newsRead this e-mail on the Web
JavaScript Weekly
Issue 332 — April 28, 2017
Redux is a popular library for managing state within JS apps, often used with React. This very thorough walkthrough covers how you’d build something similar.
Justin Deal

The JS superset includes a new comment-based type checking option, as well as support for async generators and iterators.
Microsoft

A frequently updated table of the proposals for future JS features along with their progress.
TC39

Bugsnag
Efficiently identify & resolve JavaScript errors affecting your users. Get alerted in real-time alongside detailed diagnostics, including stacktraces, plus support for sourcemaps. For a limited time, get a free t-shirt when you sign up & try Bugsnag.
Bugsnag   Sponsor

The first version with the new Ignition+Turbofan engines enabled by default, resulting in lower memory usage and faster speedup times. Will be used by Chrome 59 and Node 8.x.
Michael Hablich

A talk by Chris Heilmann of the Edge team covering the perennial topic of ‘fatigue’ over all the choices the JS ecosystem offers.
Chris Heilmann

A JS module that conjugates verbs and inflects nouns and adjectives, tell you what words are plurals or not, and more.
Alex Corvi

See how the exact same real world blogging platform is built using React or Angular on top of Node, Rails, and Django. Introductory blog post.
Thinkster

The team behind the V8 JavaScript engine want to know what proposed language features you’d like them to work on next.
Google

Jobs Supported by Hired.com

Can't find the right job? Want companies to apply to you? Try Hired.com.

In Brief

Angular 4.1: A Minor Release with Full TypeScript 2.2/2.3 Support news
Stephen Fluin

Ruby on Rails 5.1 Released, Embraces JavaScript news
The Ruby webapp framework is now a lot more JavaScript friendly.
David Heinemeier Hansson

☁️🥊 Hey Front-End Devs …Master Full Stack with Jem Young! 
Become a Full Stack Engineer and gain the confidence to master the command line and server.
Frontend Masters  Sponsor

How to Publish Packages on npm, A Video Series tutorial
Focuses on doing it the right way, complete with tests and docs.
Trevor Miller

Seven Tips for Handling 'undefined' tutorial
Dmitri Pavlutin

A Step-by-Step Guide to Building A Simple Chess AI tutorial
Lauri Hartikka

The Power of Custom Directives in Vue tutorial
Sarah Drasner

Build a Web Framework In Less Than 20 Lines Of Code tutorial
Everyday there are more new frameworks to learn, but it doesn't have to be that way!
PubNub  Sponsor

Does Glimmer Mean The Death of Ember? opinion
Robert Jackson

Why Is TypeScript Getting So Popular? opinion
Mary Branscombe

Callbacks vs Promises vs 'async/await' in a 7 Second Video video
Wassim Chegham on Twitter

Everything Is A Plugin: Mastering Webpack From The Inside Out video
An energetic, in-depth 100 minute talk/workshop.
Sean Larkin

Quokka: A Live JavaScript Scratchpad for JetBrains' IDEs tools
A month ago, this handy tool only worked with VS Code - now it supports JetBrains’ IDEs too :-)
Artem Govorov

Moon: A Minimal 5KB, Blazing Fast Vue-esque User Interface Library tools
Kabir Shah

p-event: Promisify An Event by Waiting for It to Be Emitted code
Sindre Sorhus

Slate: A Customizable Framework for Building Rich Text Editors code

angular-ssr: An Angular 4+ Server-Side Rendering Solution code
Christopher Bond

SmartPhoto.js: A Responsive Image Viewer, Especially for Mobile code

StrMan 2.0 Released: 66 Handy String Manipulation Functions code
Daniel Leite de Oliveira

Try Codeship Basic: simple hosted CI that works out of the box 
Codeship  Sponsor

Curated by Peter Cooper and published by Cooperpress.

Like this? You may also enjoy: FrontEnd Focus : Node Weekly : React Status

Stop getting JavaScript Weekly : Change email address : Read this issue on the Web

© Cooperpress Ltd. Office 30, Lincoln Way, Louth, LN11 0LS, UK


by via JavaScript Weekly

Introducing SpriteKit

A Quick Guide to Dependency Management With Bower

Using the Twitter API to Tweet Repetitive Content

Snazzy Info Window – Customizable Info Windows using Google Maps API

Snazzy Info Window is a plugin for customizable info windows using the Google Maps JavaScript API. Open sourced by the people that created Snazzy Maps.


by via jQuery-Plugins.net RSS Feed

Konterball

Minigame for googles webVR technology based on the mechanics of ping pong. Play against your friend or against the wall.
by via Awwwards - Sites of the day