Skip to content
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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Attribute #70

wants to merge 5 commits into from

Conversation

h4kuna
Copy link
Contributor

@h4kuna h4kuna commented Nov 22, 2023

Můžeš na to mrknout.

  • ještě nejdou testy, nějak se mi rozbili cesty k souborům, ale zkoušel jsem to v projektu a jede to
  • ještě bych udělal hlášení do konzole, pokud soubor nemá žádné třídy, tak aby vypsal warning, a error by byl jen pro špatně naparsované soubory? Aby to bylo rozeznatelené a errory aby uživatel opravil.

private function findAllClasses(Finder $finder, CacheMeServiceContract $cacheMeService): array
{
$cacheKey = 'larastrict.make.expectation.interfaces';
$cachedInterfaces = $cacheMeService->get($cacheKey, static fn (): ?array => null);
Copy link
Contributor Author

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.

Copy link
Contributor

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;
Copy link
Contributor Author

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?

Copy link
Contributor

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"

Copy link
Contributor

@pionl pionl left a 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');
Copy link
Contributor

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);
Copy link
Contributor

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;
Copy link
Contributor

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
Copy link
Contributor

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

Copy link
Contributor Author

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.

Copy link
Contributor

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 :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ping

@h4kuna h4kuna force-pushed the attribute branch 3 times, most recently from 1d7492e to 1e63dab Compare December 20, 2023 12:03
@pionl
Copy link
Contributor

pionl commented Jan 2, 2024

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){
Copy link
Contributor

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
Copy link
Contributor

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,
Copy link
Contributor

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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$getComposerJsonDataAction -> $composerJsonDataService

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants