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

Prevent "wrong theme name" bugs in the future #34

Open
3 tasks
zupo opened this issue Oct 9, 2018 · 3 comments
Open
3 tasks

Prevent "wrong theme name" bugs in the future #34

zupo opened this issue Oct 9, 2018 · 3 comments
Assignees
Labels
Good For Learning Issues that are well defined and with a limited scope, good for people new to the project.

Comments

@zupo
Copy link

zupo commented Oct 9, 2018

The Story

Handbook documents: User story & Work process

As a Victor,
I never want to see wrong theme name bug again,
because it is completely preventable.

Problem

Theme names are hardcoded in CartFront theme and not checked against the valid values defined in openapi.yaml schema.

Proposal

Before you start: It's Bookstore, not Books Store or Book Store. Use search & replace to fix all codebase.

Option A:

Option B:

Pitfalls

Best practices (DoD)

  • Documentation is revised:
    e.g. help articles or technical docs.
  • Product users are informed. e.g. blog post describing a new feature or bugfix.
  • Test coverage is 100%.

Expectations (AC)

  • Books Store was refactored to Bookstore.
  • Travis build fails if theme values in CartFront do not match template values in openapi.yaml spec.
  • User story demo uploaded to sprint release.
@dz0ny
Copy link
Contributor

dz0ny commented Oct 9, 2018

Enums in PHP

<?php

trait EnumHelpers {
    public static function getValues(){
      return (new ReflectionClass(get_called_class()))->getConstants(); 
    }
}

class Themes {
  use EnumHelpers;

  const BookStore = "bookstore";
  const ToyStore = "toystore";

}


var_dump(Themes::BookStore);
var_dump(Themes::getValues());

?>

See https://repl.it/repls/ForestgreenSaneWamp

ikolar added a commit that referenced this issue Jan 7, 2019
…te enum in openapi.yaml.

Used phply to parse the layouts_presets.php file and extract the stores
array from there.  Then, I fetched openapi.yaml, extracted the template
enum, and compared the two lists. The code logs an error and returns 255 if
there are any differences between them.

Added a validate command to makefile. To test it out, just run "make validate".

I still need to create travis.yml and add make validate to it.  I would also
advise to add the lint/isort/black checks since there's python code in this
repo now.

Ref: #34
@ikolar
Copy link

ikolar commented Jan 7, 2019

@zupo tried option B; would be nice if you could take a look.

@zupo
Copy link
Author

zupo commented Jan 21, 2019

What's the next step here?

@zupo zupo added the Good For Learning Issues that are well defined and with a limited scope, good for people new to the project. label Mar 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good For Learning Issues that are well defined and with a limited scope, good for people new to the project.
Development

No branches or pull requests

3 participants