Skip to content

Instantly share code, notes, and snippets.

View mattias-persson's full-sized avatar

Mattias Persson mattias-persson

View GitHub Profile
@mattias-persson
mattias-persson / Extensions
Last active December 6, 2019 07:27
VSCode config
- Advanced New File https://marketplace.visualstudio.com/items?itemName=patbenatar.advanced-new-file
- Auto Close Tag https://marketplace.visualstudio.com/items?itemName=formulahendry.auto-close-tag
- Auto Rename Tag https://marketplace.visualstudio.com/items?itemName=formulahendry.auto-rename-tag
- Better PHPUnit https://marketplace.visualstudio.com/items?itemName=calebporzio.better-phpunit
- DotENV Syntax highlighting https://marketplace.visualstudio.com/items?itemName=mikestead.dotenv
- EditorConfig https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig
- Eslint https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint
- File utilshttps://marketplace.visualstudio.com/items?itemName=sleistner.vscode-fileutils
- Import Cost https://marketplace.visualstudio.com/items?itemName=wix.vscode-import-cost
- Material theme https://marketplace.visualstudio.com/items?itemName=Equinusocio.vsc-material-theme
@mattias-persson
mattias-persson / AppServiceProvider.php
Last active April 7, 2019 14:15
assertReturnsResource (Laravel test helper)
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Foundation\Testing\TestResponse;
use Illuminate\Http\Request;
use Illuminate\Foundation\Testing\Assert as PHPUnit;
class AppServiceProvider extends ServiceProvider
@mattias-persson
mattias-persson / .phpcsfixer
Last active September 7, 2020 04:30
StyleCI Laravel Preset config for PhpCsFixer
<?php
return PhpCsFixer\Config::create()
->setRules([
'psr0' => false,
'@PSR2' => true,
'array_syntax' => ['syntax' => 'short'],
'phpdoc_indent' => true,
'cast_spaces' => ['space' => 'single'],
'binary_operator_spaces' => [],
@mattias-persson
mattias-persson / TestCase.php
Last active January 17, 2019 14:50
Laravel PHPUnit - Nice helpers
/**
* Assert that a model contains an exact set of attributes.
* Example: $this->assertModelHasExactAttributes($user, ['email', 'password', 'created_at']);
*
* @param Illuminate\Database\Eloquent\Model $model
* @param array $attributes
* @return Illuminate\Foundation\Testing\TestCase
*/
public function assertModelHasExactAttributes($model, $attributes = [])
{
@mattias-persson
mattias-persson / ExampleComponent.spec.js
Last active May 12, 2020 15:32
Quickly setup Mocha on an installation of Laravel with Vue and Laravel Mix
// tests/JavaScript/ExampleComponent.spec.js
import { mount } from 'vue-test-utils';
import expect from 'expect';
import moxios from 'moxios';
import Helpers from 'mwangaben-vthelpers';
import ExampleComponent from '../../resources/assets/js/components/ExampleComponent.vue';
describe ('ExampleComponent', () => {