Skip to content

add phpunit setup and initial tests for social api#6

Closed
neerajp99 wants to merge 35 commits intodrupalsocialinitiative:8.x-2.xfrom
neerajp99:8.x-2.x
Closed

add phpunit setup and initial tests for social api#6
neerajp99 wants to merge 35 commits intodrupalsocialinitiative:8.x-2.xfrom
neerajp99:8.x-2.x

Conversation

@neerajp99
Copy link
Member

No description provided.

@utkarsh-dixit
Copy link

There are vendor files included in the commit. Add the vendor folder to gitignore.

@gvso
Copy link
Contributor

gvso commented Jun 2, 2019

Vendor files should never be in the module folders. Same goes for the composer.lock file. You shouldn't run composer install inside the module. You should only do it in the Drupal root folder.

@himanshu-dixit
Copy link
Contributor

Should we add assertion here to check setClient is working successfully and returning something?
Screenshot 2019-06-02 at 10 24 48 PM

Copy link
Contributor

@gvso gvso left a comment

Choose a reason for hiding this comment

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

I didn't look at everything nor added comments for everything I have reviewed. In general, you have to follow the comments I gave you and apply them everywhere. Do not only change the things I explicitly pointed out to, but also all the things that are similar to the things I pointed out. There are many things that need to be added/changed/improved. I hope you learn (and I know you will) from this and become a better coder as we go, so I don't have to add many stylistic/simple comments next time. Just remember that making something work is simple, so you have to push beyond that if you wanna be successful at this. Make it work, but also make it efficient, beautiful, easy to understand, and easy to use.

->getMockForAbstractClass();
$this->assertTrue($collection instanceof UserManager);
// checking for correct setPluginId and getPluginId method
$collection->setPluginId('1234');
Copy link
Contributor

Choose a reason for hiding this comment

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

You have to add tests for both paths of getDrupalUserId

Copy link
Contributor

@gvso gvso left a comment

Choose a reason for hiding this comment

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

Please, read my recommendations and follow them. If you're not planning to do so, let me know, so I can stop wasting my time. I stop adding comments after the second one I added. Please, follow ALL the recommendations I have given so far and let me know when this is ready to be reviewed (I will create a label for that too).

Copy link
Contributor

@gvso gvso left a comment

Choose a reason for hiding this comment

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

@neerajp99 You're not testing the real stuff. You're only testing if a method exists most of the time. That's not so useful. Think of why we want tests. We don't care much about knowing if a method exists, but what a method does.

*
* @Annotation
*/
class ControllerTest extends UnitTestCase {
Copy link
Contributor

Choose a reason for hiding this comment

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

Use the same name as in the source code, but add Test at the end (SocialApiControllerTest)

* Tests for class SocialApiException.
*/
public function testException() {
$socialApiException = new SocialApiException();
Copy link
Contributor

@gvso gvso Jun 20, 2019

Choose a reason for hiding this comment

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

This test does not make sense. If you want to test this class, just test that the message is set correctly, etc.

@gvso
Copy link
Contributor

gvso commented Nov 25, 2019

I created a new PR for this #10

@gvso gvso closed this Nov 25, 2019
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.

4 participants