Skip to content

Instantly share code, notes, and snippets.

@Chemaclass
Last active August 9, 2020 11:08
Show Gist options
  • Select an option

  • Save Chemaclass/07704606fcb337dbb0881c94197c329e to your computer and use it in GitHub Desktop.

Select an option

Save Chemaclass/07704606fcb337dbb0881c94197c329e to your computer and use it in GitHub Desktop.
Unit testing effectively - Logic example (Part I)
<?php declare(strict_types=1);
namespace Company\Domain;
final class MyBusinessLogic
{
private DependencyInterface $dependencyInterface;
private ConcreteDependency $concrete;
public function __construct(
DependencyInterface $dependencyInterface,
ConcreteDependency $concrete
) {
$this->dependencyInterface = $dependencyInterface;
$this->concrete = $concrete;
}
public function applySomeLogic(Input $input): ReturnType
{
// black box responsible to create a ReturnType
// based on the given Input
return $returnType;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment