Skip to content

Instantly share code, notes, and snippets.

View christophrumpel's full-sized avatar
🤠
PHP/Laravel Developer and Author

Christoph Rumpel christophrumpel

🤠
PHP/Laravel Developer and Author
View GitHub Profile
it('returns readable video duration', function () {
// Arrange
$video = Video::factory()->create(['duration_in_min' => 10]);
// Act & Assert
expect($video->getReadableDuration())->toEqual('10min');
});
it('belongs to a course', function () {
// Arrange
<?php
declare(strict_types=1);
namespace Pest\Logging;
use Illuminate\Console\BufferedConsoleOutput;
use NunoMaduro\Collision\Adapters\Phpunit\State;
use NunoMaduro\Collision\Adapters\Phpunit\Style;
use NunoMaduro\Collision\Adapters\Phpunit\TestResult as CollisionTestResult;
@christophrumpel
christophrumpel / app\Math.php
Last active August 26, 2022 06:41
Created by Pest Playground
<?php
namespace App;
class Math
{
public static function add($a, $b)
{
return $a + $b;
}
@christophrumpel
christophrumpel / mp_post_for_ln.md
Last active March 21, 2021 10:06
MP Post for LN

Mastering PhpStorm Header image showing the logo in space with planets and a space ship

When we talk about developing for PHP, there is one IDE that stands out: PhpStorm. It knows your application like no other editor.

But it comes with some drawbacks. The moment you install it, it looks ugly, you are overwhelmed by the number of features thrown at your face, and everything feels slow.

Mastering PhpStorm is a video course that rescues you from this mess. It helps PhpStorm beginners by setting everything up together step by step and benefits advanced PhpStorm users by providing all these little tips and tricks to improve their development workflow even further.

It's a video course for the state-of-the-art PHP developer who wants to work efficiently and successfully in a beautiful IDE.

This PR solves the order bug when using command and other assertions in the same test.

Please find more detailed informion in the issue XX

Current State

Laravel command assertions (expectations) are being run before the application gets destroyes. This is why command assertions alwaysrun at the end of the test and not in the provided order inside the test.

This PR adds a new console test method for asking choices.

Current State

You can ask a multiple-choice question in a Laravel command with the choice method:

$name = $this->choice('What is your name?', ['Taylor', 'Dayle'], $defaultIndex);
@christophrumpel
christophrumpel / Laravel Factories Reloaded.md
Created January 20, 2020 09:32
Laravel Factories Reloaded

While testing our Laravel applications, we often need to work with dummy data. Most of the time, it is model instances that we require, and Laravel has an excellent factory system to helps us creating them.

It works great, but the bigger your applications get, the more difficult it gets to prepare your test data. For example, instead of a user, you might need a user who is admin, has created three articles within the category support and is active. What happens now is that your tests get bloated wile you create all these models and relationships. This is when it gets messy, and your tests are not good to follow anymore.

In this talk, I want to show you how we can handle these situations and what my best-practices are regarding Laravel factories. Attendees will be able to use these practices to keep their factories and tests clean and enjoyable.

@christophrumpel
christophrumpel / PhpStorm - From a Fresh Install To A Master Setup.md
Last active January 20, 2020 09:06
PhpStorm - From a Fresh Install To A Master Setup

PhpStorm is one of the best IDE's for PHP available. It comes with a ton of features to make developing with PHP as easy as possible. But it is also this amount of possibilities that make it sometimes difficult to know what you want to use and where to find it.

Here comes the best feature of PhpStorm into play: Everything is customizable! Let's start with a fresh PhpStorm install and set it up together. We will make the theme look stunning and configure our Laravel application for testing, debugging, and your daily work with Laravel.

On the way, we will come across a lot of helpful little tips and tricks that you might not know yet. This talk will give you a crash course on how to use PhpStorm and what it has to offer for working with Laravel. Even if you're already working with it for a long time, you will get away with new learnings to improve your setup. Your IDE is one of your most essential tools. Let's master it!

@christophrumpel
christophrumpel / gist:63732918166d2623dc65d14a88472139
Created April 11, 2019 19:01
Deskpro API Articles with artitcles
// https://helpdesk.steinbach.at/api/v2/articles?category[]=12
{
"data": [
{
"id": 23,
"person": 21,
"language": 2,
"slug": "die-pumpe-l-sst-sich-nicht-einschalten",
"title": "Die Pumpe lässt sich nicht einschalten.",
@christophrumpel
christophrumpel / laravel-notifications-talk-abstract.md
Last active November 13, 2018 06:19
The beauty of Laravel's notification system and how it helped me to create my first Laravel package

The beauty of Laravel's notification system and how it helped me to create my first Laravel package

Every modern application has some kind of notifications. This could be an E-Mail that informs the user about a new product, a note on the desktop that says a friendship request was accepted, a message on Slack that informs you about a successful build and so on. Laravel has a built-in notification system that makes all these tasks as simple as it can get. Let me show you how it works, how it helped me to create me first Laravel package and what the community has to offer to make notifications even more powerful. This is a practical approach to this topic and there will be some coding involved 😉