-
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Attribute #70
base: main
Are you sure you want to change the base?
Attribute #70
Conversation
private function findAllClasses(Finder $finder, CacheMeServiceContract $cacheMeService): array | ||
{ | ||
$cacheKey = 'larastrict.make.expectation.interfaces'; | ||
$cachedInterfaces = $cacheMeService->get($cacheKey, static fn (): ?array => null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Použil jsem keš, pro další průchod, se neparsují již existující soubory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tu keš asi nechápu :) Ty chceš to cachovat mezi volání commandu? Nevím jestli je to správně pokud tam nebude stejně check jestli implementace se nezměnila, a to mě připadá trochu out of scope (docela dost pracné).
Jinak za mě špatně použitá ta funkce - přesunout "ten" search do fn () a bud se spustí pokud cache není a nebo ne.
|
||
interface SetUpFinderActionContract | ||
{ | ||
public function execute(Finder $finder): Finder; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Říkal jsem si jestli udělat factory na Finder, nebo jen takto mít možnost upravit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dal bych factory jak píšeš a consumer si to pak přes container můžeš "switchnout"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
asi si zavoláme?
$class = (string) $this->input->getArgument('class'); | ||
|
||
if ($class === 'all') { | ||
$finder = Finder::create()->files()->name('*.php'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm asi bych udělal factory které mě sestaví ten finder místo setup, připadá mě to čistější a lépe testovatelné stubem
private function findAllClasses(Finder $finder, CacheMeServiceContract $cacheMeService): array | ||
{ | ||
$cacheKey = 'larastrict.make.expectation.interfaces'; | ||
$cachedInterfaces = $cacheMeService->get($cacheKey, static fn (): ?array => null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tu keš asi nechápu :) Ty chceš to cachovat mezi volání commandu? Nevím jestli je to správně pokud tam nebude stejně check jestli implementace se nezměnila, a to mě připadá trochu out of scope (docela dost pracné).
Jinak za mě špatně použitá ta funkce - přesunout "ten" search do fn () a bud se spustí pokud cache není a nebo ne.
|
||
interface SetUpFinderActionContract | ||
{ | ||
public function execute(Finder $finder): Finder; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dal bych factory jak píšeš a consumer si to pak přes container můžeš "switchnout"
use Attribute; | ||
|
||
#[Attribute] | ||
final class TestAssert |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tohle má být v tests složce
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jakože Testing/Attributes/Tests ?
tests/ jsou testy, tam asi nebudu dávat atribut.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ne myslím tím tento objekt TestAssert
který očividně slouží pro náš test :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ping
1d7492e
to
1e63dab
Compare
Seems like all working as expected! Can you finalize commit message? |
// our implementation expets always composer.json file | ||
$this->fileSystem->shouldReceive('isFile') | ||
->once() | ||
->with(function($arg) use ($expectedComposerCheck){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
usage is withArgs and method must return boolean
use Attribute; | ||
|
||
#[Attribute] | ||
final class TestAssert |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ping
public function __construct( | ||
private readonly Filesystem $filesystem, | ||
private readonly ComposerJsonDataService $getComposerJsonDataAction, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$getComposerJsonDataAction -> $composerJsonDataService
private array $dirs = []; | ||
|
||
public function __construct( | ||
private readonly ComposerJsonDataService $getComposerJsonDataAction, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$getComposerJsonDataAction -> $composerJsonDataService
Můžeš na to mrknout.