Skip to content

Feature/viewmodel/teaser non article content #1

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

Merged
merged 12 commits into from
Jun 14, 2016
Merged

Feature/viewmodel/teaser non article content #1

merged 12 commits into from
Jun 14, 2016

Conversation

davidcmoulton
Copy link
Member

Adds tests and implementations for most fields, outstanding are date and image. Date needs to be its own pattern in patternlab so that it has a template path, before being able to inherit from ViewModel here. Image looks like it's going to be its own patternlab pattern too.

Due to incomplete nature of this, I don't mind if this pull request is not merged yet as it stands, but I think a sanity check on the approach will be valuable.

Small atomic commits are used in order to maintain good separation while I'm learning the codebase. These can be squashed before/on merge.

@@ -14,7 +14,7 @@
final public function offsetGet($offset)
{
if (false === $this->offsetExists($offset)) {
return null;
return;
Copy link
Member Author

Choose a reason for hiding this comment

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

This change was introduced by php-cs-fixer, and is outside the scope of the fileset for the feature addressed by this pull request.

Copy link
Contributor

Choose a reason for hiding this comment

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

See symfony/symfony#17201. In this case the intent is to return null, but PHP doesn't currently have a void return type so it ends up being null anyway. However, PHP 7.1 has introduced them, so we should match it.

I think you can disable that check in the fixer.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, I can't recreate it.

@davidcmoulton
Copy link
Member Author

All checks pass when running locally within PHPStorm, but the Travis checks failed. There are 10 failures, all along the same lines. It's complaining Class 'Puli\GeneratedPuliFactory' not found for each of the test cases, for example:

  1. tests\eLife\Patterns\ViewModel\TeaserNonArticleContentTest::it_must_have_headertext
    Error: Class 'Puli\GeneratedPuliFactory' not found
    /home/travis/build/elifesciences/patterns-php/tests/src/PuliAwareTestCase.php:20

See details of the Travis run for more information.

@thewilkybarkid
Copy link
Contributor

The Travis failure is due to Puli being broken with Composer 1.1 (see puli/issues#190). I'll look at what we can do.

@thewilkybarkid
Copy link
Contributor

2eb9c71 fixes Travis.

use eLife\Patterns\CastsToArray;
use eLife\Patterns\ReadOnlyArrayAccess;

class Date implements CastsToArray
Copy link
Contributor

Choose a reason for hiding this comment

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

final

use eLife\Patterns\ViewModel;
use Traversable;

class TeaserNonArticleContent implements ViewModel
Copy link
Contributor

Choose a reason for hiding this comment

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

final

@thewilkybarkid thewilkybarkid merged commit 96b4923 into elifesciences:master Jun 14, 2016
@davidcmoulton davidcmoulton deleted the feature/viewmodel/teaser-non-article-content branch June 27, 2016 15:29
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