Skip to content
This repository has been archived by the owner on Sep 24, 2020. It is now read-only.

Add core unit tests (#170) #183

Merged
merged 5 commits into from
Nov 21, 2016
Merged

Add core unit tests (#170) #183

merged 5 commits into from
Nov 21, 2016

Conversation

DannyvdSluijs
Copy link

Hey!

Type: code quality

Link to issue: #170

This pull request affects the following components: (please check boxes)

  • Core
  • Analyzer
  • Compiler
  • Control Flow Graph
  • Documentation

In raising this pull request, I confirm the following (please check boxes):

  • I have read and understood the Contributing Guidelines?
  • I have checked that another pull request for this purpose does not exist.
  • I wrote some tests for this PR.

Small description of change: Added core unit tests for IssuesCollector, ScopePointer and Application

Thanks

*
* @link http://scm.monitorlinq.com/backend
* @copyright Copyright (c) 2016 Monitorlinq Limited
* @license http://www.monitorlinq.com/license Proprietary License
Copy link
Collaborator

Choose a reason for hiding this comment

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

whats this?

Copy link
Author

Choose a reason for hiding this comment

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

My mistake, will remove it and add to the PR.

$application = new Application();

$this->assertInstanceOf('\PHPSA\Application', $application);
$this->assertInstanceOf('\Symfony\Component\Console\Application', $application);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't know what @ovr and @ddmler think about that, but I don't really see the value in this kind of assertions.
Tests should reflect the behavior of the system, how it reacts given some input data, … Just testing that a class can be instantiated does not seem that useful to me.

Copy link
Author

Choose a reason for hiding this comment

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

Am okie to remove, was trying to protect backwards compatibility (construct function without parameters) when the construct function might get parameters in the future.
Let me know.

Copy link
Owner

Choose a reason for hiding this comment

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

I dont known, for me it's not need
It's rly simple tests that cannot give nothing, about BC I dont thing that someone will extends from \PHPSA\Application, but maybe...

class ApplicationTest extends TestCase
{
/**
* @covers \PHPSA\Application::__construct
Copy link
Collaborator

Choose a reason for hiding this comment

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

@ovr and @ddmler do we really want to use these annotations?

Copy link
Author

Choose a reason for hiding this comment

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

The annotation ensures that the coverage is limited to that function(s) that is/are being tested. To ensure the coverage is only measured to what is validated using assertions.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I know what it does, I'm just not sure that we actually want to use this feature :)

Copy link
Owner

Choose a reason for hiding this comment

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

I am okey with @Covers, https://phpunit.de/manual/3.7/en/appendixes.annotations.html#appendixes.annotations.covers
This can help to avoid green code on code coverage, but it's not an important thing for me
And this @Covers helps to navigate in the code with clicking on it

@ovr ovr added this to the Release 0.6.1 milestone Nov 12, 2016
@DannyvdSluijs
Copy link
Author

Hi Guys,

I'm having some time to continue this. Any comments on what is needed to accept the PR?

BR

@ddmler
Copy link
Collaborator

ddmler commented Nov 15, 2016

I think if you remove the method testConstructor in ScopePointerTest and the ApplicationTest file we can merge.
There seems to be no useful test for application so we leave that out.

@DannyvdSluijs
Copy link
Author

@ddmler Please find the additional commits removing the constructor test and support the changes merged from upstream.

@ddmler ddmler merged commit 35ec269 into ovr:master Nov 21, 2016
@ddmler
Copy link
Collaborator

ddmler commented Nov 21, 2016

Thanks @DannyvdSluijs 👍

@ovr
Copy link
Owner

ovr commented Nov 22, 2016

@ddmler

image

image

@ovr
Copy link
Owner

ovr commented Nov 22, 2016

[phpsa] Branch "master" was force-pushed to d8102bc by ovr. Compare changes

@ovr
Copy link
Owner

ovr commented Nov 22, 2016

branch, was interactive rebased and cherry-picked into master without merge commits

image

@DannyvdSluijs
Copy link
Author

@ovr Thanks for taking the issue. Could you show the specific steps/commands used to achieve the rebase. Rebasing is still somewhat unclear to me. Next time it would like to spare you the trouble.

@ddmler
Copy link
Collaborator

ddmler commented Nov 22, 2016

@ovr sorry didn't see the merge commit
@DannyvdSluijs https://git-scm.com/book/en/v2/Git-Branching-Rebasing
or check the image from ovr .. there is a typo it's remote instead of remove

@ovr
Copy link
Owner

ovr commented Dec 2, 2016

@ovr sorry didn't see the merge commit
@ddmler not a problem :)

@DannyvdSluijs , @ddmler write you link or your can review how to rebase in our documentation inside project

Sorry, for late reply :(

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

Successfully merging this pull request may close these issues.

None yet

4 participants