Skip to content

Instantly share code, notes, and snippets.

View vjandrea's full-sized avatar

Andrea Bergamasco vjandrea

View GitHub Profile
@vjandrea
vjandrea / phpversion.sh
Last active June 19, 2023 20:44
Change php cli version in plesk
#!/bin/sh
printf "Switching php to version 5.6 with symlinks.\n"
printf "Press any key to continue...\n"
read CONTINUE
printf "Creating backups..."
# Backup original binaries
<snippet>
<tabTrigger>test</tabTrigger>
<content><![CDATA[
/**
* @test
*/
public function ${1:test_name}()
{
\$this->markTestIncomplete();
}
@vjandrea
vjandrea / snippets.cson
Created January 19, 2017 09:44
Atom snippets - PHPUnit placeholder test
'.source.php':
'PHPUnit test':
'prefix': 'test'
'body': """
/**
* @test
*/
public function ${1:test_name}()
{
\$this->markTestSkipped('This test has not been written yet');
@vjandrea
vjandrea / local_travisci_docker.txt
Last active February 22, 2017 12:33
TravisCI Docker local
# change the image according to the language chosen in .travis.yml
$ docker run -it -u travis quay.io/travisci/travis-jvm /bin/bash
# now that you are in the docker image, switch to the travis user
sudo - travis
# Install a recent ruby (default is 1.9.3)
rvm install 2.3.0
rvm use 2.3.0
@vjandrea
vjandrea / snipe-it-api-map.md
Created February 23, 2017 12:05
API Map for Snipe-IT

Snipe-IT API Map

Domain Method URI Name Action Middleware
GET/HEAD api/v1/accessories api.accessories.index App\Http\Controllers\Api\AccessoriesController@index auth:api
POST api/v1/accessories api.accessories.store App\Http\Controllers\Api\AccessoriesController@store auth:api
GET/HEAD api/v1/accessories/{accessory} api.accessories.show App\Http\Controllers\Api\AccessoriesController@show auth:api
PUT/P
@vjandrea
vjandrea / ApiTests error.md
Last active March 12, 2017 21:02
Error in every single api test
[Exception] Serialization of 'Closure' is not allowed

1  /vjandrea-snipe-it/vendor/laravel/framework/src/Illuminate/Session/Store.php:128
2  /vjandrea-snipe-it/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php:88
3  /vjandrea-snipe-it/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:216
4  /vjandrea-snipe-it/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:187
5  /vjandrea-snipe-it/vendor/symfony/browser-kit/Client.php:315
6  Codeception\Module\REST->sendDELETE
7 /vjandrea-snipe-it/tests/_support/_generated/ApiTesterActions.php:360
@vjandrea
vjandrea / updateAssetWithPatch.md
Created March 13, 2017 21:39
Failing ApiAssetsCest::updateAssetWithPatch
2) ApiAssetsCest: Update an asset with patch
 Test  tests/api/ApiAssetsCest.php:updateAssetWithPatch
 Step  See response contains json {"id":101,"name":"Open-architected 4thgeneration neural-net","asset_tag":"574632016","serial":"06665cae-548e-3745-91e0-fd76d30706d4","model":{"id":5,"name":"Profit-focused upward-trending complexi...}
 Fail  Response JSON does not contain the provided JSON

- Expected | + Actual
@@ @@
Array (
'id' =&gt; 101
@vjandrea
vjandrea / debugging.md
Last active March 14, 2017 15:19
Debugging asset update
[2017-03-14 16:19:30] local.DEBUG: [Api\AssetsController::update] Updating asset with id 101 with method PATCH  
[2017-03-14 16:19:30] local.DEBUG: [Api\AssetsController::update] Original asset name: "Focused tangible neural-net"  
[2017-03-14 16:19:30] local.DEBUG: [Api\AssetsController::update] Updated asset name: "Profit-focused bifurcated capacity"  
[2017-03-14 16:19:30] local.DEBUG: [Api\AssetsController::update] Asset name before custom fields association: "5"  
[2017-03-14 16:19:30] local.DEBUG: [Api\AssetsController::update] Asset name inside custom fields association: "5"  
[2017-03-14 16:19:30] local.DEBUG: [Api\AssetsController::update] Asset name after custom fields association: "5"  
[2017-03-14 16:19:30] local.DEBUG: [Api\AssetsController::update] Asset name right before saving: "5"  
[2017-03-14 16:19:30] local.DEBUG: [Api\AssetsController::update] Asset name right after saving: "5"  
[2017-03-14 16:19:30] local.DEBUG: [Api\AssetsController::update] Final asset name before response: "5" 
@vjandrea
vjandrea / failing.md
Created March 21, 2017 12:09
[Exception] Serialization of 'Closure' is not allowed with Codeception (REST+Laravel5 modules) testing an API
$ codecept run api -f -vvv
Codeception PHP Testing Framework v2.2.9
Powered by PHPUnit 5.7.17 by Sebastian Bergmann and contributors.

  Rebuilding ApiTester...

Api Tests (12)
Modules: \Helper\Api, REST, Laravel5, Asserts
@vjandrea
vjandrea / failing.md
Created March 22, 2017 12:19
Unit testing failures
$ codecept run unit
Codeception PHP Testing Framework v2.2.9
Powered by PHPUnit 5.7.9 by Sebastian Bergmann and contributors.

Unit Tests (976) -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- FrameworksTest: Text field by label without forPHP Fatal error:  Cannot declare class Codeception\TestCase\Test, because the name is already in use in /Users/{me}/Documents/Github/Codeception/shim.php on line 18
PHP Stack trace:
PHP   1. {main}() /usr/local/bin/codecept:0
PHP 2. require_once() /usr/local/bin/codecept:7