By Umayal on
I want to test user login and logout.
I created a test file(Uofloggingtest.php) in user module test.
It has following code.
class Uofloggingtest extends UnitTest {
private User user;
void setUp(){
this.user=user.GetSampleUser();
}
void testUserSetName(){
this.user.setName('admin');
this.assertTrue(this.user.name.length)>0);
this.assertFlase(this.user.name=='anonym');
this.asserEquals('admin',this.user.getName);
}
}
but it shows the following error.
Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE in /xxx/core/modules/user/lib/Drupal/user/Tests/Uofloggingtest.php on line 16
what mistake I have done?, how to rectify it?
Comments
PHP doesn't use dot notation
PHP doesn't use dot notation to access its properties and methods. See- http://php.net/manual/en/language.oop5.basic.php
Thanks for replay, how to get
Thanks for replay,
how to get login/logout user in a variable(using $this) for testing.
error removed