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

FIX Use get_one_by_stage when fetching SiteTree for a specific stage #52

Merged

Conversation

ScopeyNZ
Copy link
Contributor

@ScopeyNZ ScopeyNZ commented Aug 21, 2018

I had trouble reproducing this using the steps that @Cheddam provided but I managed to reproduce it consistently with a test (that I've added to this commit). Yay for TDD!

Resolves #51

protected static $fixture_file = 'HistoryControllerFactoryTest.yml';

protected static $illegal_extensions = [
HistoryControllerFactory::class => ['DNADesign\Elemental\Extensions\HistoryControllerFactoryExtension']
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should just remove every extension on this rather than individual ones. Other modules could have interfered with this as well, we ideally want to clear the global state and isolate it with your stub extension below right?

protected static $illegal_extensions = [
    HistoryControllerFactory::class => '*',
];

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ideally yes - all extensions are bad but the TestOnly one. I didn't even know that you could use '*'.

@@ -0,0 +1,14 @@
<?php
namespace SilverStripe\AssetAdmin\Tests\Controller\HistoryControllerFactory;
Copy link
Contributor

Choose a reason for hiding this comment

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

The package name is wrong

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🤦‍♂️

{
public function updateIsEnabled($record)
{
return $record->Title === '2';
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a comment that this is referring to HistoryControllerFactoryTest.yml fixtures?

@ScopeyNZ ScopeyNZ force-pushed the pulls/1.0/stage-fright branch from 44bd485 to 45b4980 Compare August 22, 2018 00:05
@ScopeyNZ ScopeyNZ force-pushed the pulls/1.0/stage-fright branch from 45b4980 to 6be253c Compare August 22, 2018 00:20
@ScopeyNZ
Copy link
Contributor Author

Made the suggested changes 🙂

@robbieaverill robbieaverill merged commit 4ee9497 into silverstripe:1.0 Aug 22, 2018
@robbieaverill robbieaverill deleted the pulls/1.0/stage-fright branch August 22, 2018 01:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants