Здесь я собираю годное чтиво, которое можно кинуть в случае чего в качестве ответа на какие-либо сложные вопросы
https://simpleprogrammer.com/2010/12/12/back-to-basics-why-unit-testing-is-hard/
Back to Basics: Why Unit Testing is Hard
перевод адаптирован под 2017-ый, где у нас нет проблем с mock фреймворками, и нам не обязательно создавать интерфейс дабы сделать мок.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function upload (url, files, config) { | |
config = config || {}; | |
files = angular.isArray(files) ? files : [files]; | |
config.transformRequest = angular.identity; | |
config.headers = config.headers || {}; | |
config.headers['Content-Type'] = undefined; | |
return fileAppender(files).then(function (formData) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\DependencyInjection; | |
use Symfony\Component\DependencyInjection\ContainerBuilder; | |
use Symfony\Component\HttpKernel\DependencyInjection\Extension; | |
use Symfony\Component\Finder\Finder; | |
class AppExtension extends Extension | |
{ |
Title | Change password |
---|---|
URL | /api/users/passwordChange |
Method | POST |
Headers | Authorization=Bearer token Content-type: application/json |
Params | password=current password newPassword=new password |
Data Params | example { "password": "password", "newPassword": "pass" } |
Success Response | example{"token":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXUyJ9"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Контроллеры не особо видоизменились. | |
// Единственное что поменялось - больше ненадо использовать $scope. | |
class MyComponentController { | |
constructor(myService) { | |
this.myService = myService; | |
} | |
doSomething() { | |
this.myService.doSomething(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class DefaultMyStuffMaker implements MyStuffMaker | |
{ | |
private $dependency; | |
public function __construct(SomeDependency $dependency) | |
{ | |
$this->dependency = $dependency; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Fesor\Caffeine; | |
final class Scope | |
{ | |
private $payload; | |
private $parent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Comment | |
{ | |
private $message; | |
private $author; | |
private $createdAt; | |
public function __construct(string $message, User $author) | |
{ |
This is template for jetbrains webstorm/phpstorm/idea for generating component placeholder file.