Skip to content

Conversation

@NebriBlackwing
Copy link
Member

This PR should close #197, this is my first PR into an open source project.

If I have missed anything / need revisions please advise upon completing your review.

Thanks very much, this was a great learning experience!

Ryan Fletcher added 12 commits July 10, 2018 17:10
Signed-off-by: Ryan Fletcher <ryan.fletcher@codepassion.ca>
Signed-off-by: Ryan Fletcher <ryan.fletcher@codepassion.ca>
Signed-off-by: Ryan Fletcher <ryan.fletcher@codepassion.ca>
Signed-off-by: Ryan Fletcher <ryan.fletcher@codepassion.ca>
Signed-off-by: Ryan Fletcher <ryan.fletcher@codepassion.ca>
…Test

Signed-off-by: Ryan Fletcher <ryan.fletcher@codepassion.ca>
Signed-off-by: Ryan Fletcher <ryan.fletcher@codepassion.ca>
Signed-off-by: Ryan Fletcher <ryan.fletcher@codepassion.ca>
Signed-off-by: Ryan Fletcher <ryan.fletcher@codepassion.ca>
Signed-off-by: Ryan Fletcher <ryan.fletcher@codepassion.ca>
Signed-off-by: Ryan Fletcher <ryan.fletcher@codepassion.ca>
Signed-off-by: Ryan Fletcher <ryan.fletcher@codepassion.ca>
@NebriBlackwing NebriBlackwing changed the title Issue 197 Closes Issue #197 pending successful review. Jul 11, 2018
@juliusknorr juliusknorr changed the title Closes Issue #197 pending successful review. Add default board Jul 12, 2018
@juliusknorr juliusknorr self-requested a review July 12, 2018 06:37
@juliusknorr juliusknorr added this to the 0.5.0 milestone Jul 12, 2018
Copy link
Member

@juliusknorr juliusknorr left a comment

Choose a reason for hiding this comment

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

Some small codestyle comments. But besides that, really nice work.

}

public function testCheckFirstRunCaseTrue() {
$appName = "Deck";
Copy link
Member

Choose a reason for hiding this comment

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

Always use single quotes please 😉

$this->cardService = $this->createMock(CardService::class);
$this->config = $this->createMock(IConfig::class);

$this->l10n = $this->request = $this->getMockBuilder(
Copy link
Member

Choose a reason for hiding this comment

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

You can also use createMock here.

}

public function testCheckFirstRunCaseFalse() {
$appName = "deck";
Copy link
Member

Choose a reason for hiding this comment

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

Single quotes

public function testIndexOnFirstRun() {

$board = new Board();
$board->setTitle("Personal");
Copy link
Member

Choose a reason for hiding this comment

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

single quotes

}

public function checkFirstRun($userId, $appName) {
$firstRun = $this->config->getUserValue($userId,$appName,'firstRun','yes');
Copy link
Member

Choose a reason for hiding this comment

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

Please add a space after the ,

$userBoards = $this->boardMapper->findAllByUser($userId);

if ($firstRun === 'yes' && count($userBoards) === 0) {
$this->config->setUserValue($userId,$appName,'firstRun','no');
Copy link
Member

Choose a reason for hiding this comment

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

space after ,


public function testIndexOnSecondRun() {

$this->config->setUserValue($this->userId,'deck','firstRun','no');
Copy link
Member

Choose a reason for hiding this comment

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

space after ,

"View more" : "View more",
"Move board to archive" : "Move board to archive",
"Create a new board" : "Create a new board"
"Create a new board" : "Create a new board"
Copy link
Member

Choose a reason for hiding this comment

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

This change can be removed as well.

Copy link
Member Author

Choose a reason for hiding this comment

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

Isn't this string part of the l10n definitions? I see it in every other file, all I did here was remove the comma I appended at the end of the line, and obvious I accidentally added in some extra white space.

Copy link
Member

Choose a reason for hiding this comment

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

I was referring to the whitespace 😉 But that's a non-blocker.

"View more" : "View more",
"Move board to archive" : "Move board to archive",
"Create a new board" : "Create a new board"
"Create a new board" : "Create a new board"
Copy link
Member

Choose a reason for hiding this comment

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

Same here.

@juliusknorr
Copy link
Member

👍 for adding tests. There seems to be one still failing:


There was 1 failure:

1) OCA\Deck\Service\DefaultBoardServiceTest::testCreateDefaultBoard
Expectation failed for method name is equal to <string:create> when invoked 3 time(s)
Parameter 0 for invocation #0 OCA\Deck\Service\StackService::create(null, 5, 1) does not match expected value.
Failed asserting that null matches expected 'To do'.

/drone/src/github.com/nextcloud/server/apps/deck/lib/Service/DefaultBoardService.php:78
/drone/src/github.com/nextcloud/server/apps/deck/tests/unit/Service/DefaultBoardServiceTest.php:168

@NebriBlackwing
Copy link
Member Author

There was 1 failure:

  1. OCA\Deck\Service\DefaultBoardServiceTest::testCreateDefaultBoard
    Expectation failed for method name is equal to string:create when invoked 3 time(s)

Parameter 0 for invocation #0 OCA\Deck\Service\StackService::create(null, 5, 1) does not match expected value.
Failed asserting that null matches expected 'To do'.

/drone/src/github.com/nextcloud/server/apps/deck/lib/Service/DefaultBoardService.php:78
/drone/src/github.com/nextcloud/server/apps/deck/tests/unit/Service/DefaultBoardServiceTest.php:168

Part of this test is checking that the name of the stacks is being set, and those names are going through l10n->t which does not yet have a definition for those strings, hence why the test fails.

Should I be removing that part of the test?

Ryan Fletcher added 2 commits July 12, 2018 11:17
Signed-off-by: Ryan Fletcher <ryan.fletcher@codepassion.ca>
Signed-off-by: Ryan Fletcher <ryan.fletcher@codepassion.ca>
->willReturn($board);

$stackToDoId = '123';
$stackToDo = $this->assembleTestStack($this->l10n->t('To do'), $stackToDoId, $boardId);
Copy link
Member

@juliusknorr juliusknorr Jul 13, 2018

Choose a reason for hiding this comment

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

If you mock the t call on l10n with something like:

$this->l10n->expects($this->any())
	->method('t')
	->willReturnCallback(function($text) { return $text } );

you can just call $this->assembleTestStack('To do' ... then and use the plain string for further checks.

Copy link
Member Author

Choose a reason for hiding this comment

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

Great, just submitted the revision, once your build server finishes it's thing you should be good to go :).

Signed-off-by: Ryan Fletcher <ryan.fletcher@codepassion.ca>
@juliusknorr
Copy link
Member

Sign off check failing due to github branch update. Let's merge this.

@juliusknorr juliusknorr merged commit 6bf4efb into nextcloud:master Jul 14, 2018
@juliusknorr
Copy link
Member

@Nebri Congratulations to your first open source contribution. 🎉 I'm glad to have you on board for the deck app.

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.

Add default board on first use [$10 awarded]

2 participants