Skip to content

Commit

Permalink
fixed tests, updated travis config
Browse files Browse the repository at this point in the history
  • Loading branch information
rakshazi committed Mar 12, 2020
1 parent 72874d8 commit d1dc64b
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
14 changes: 7 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@ language: php

git:
depth: 1
cache:
directories:
- $HOME/.composer

cache:
directories:
- $HOME/.composer

env:
global:
- PHP_CS_FIXER_IGNORE_ENV=1

php:
- 7.1
- 7.2
- 7.3

before_script:
- composer install
- composer require phpunit/phpunit:7.0.2 satooshi/php-coveralls wtf/rest wtf/html dflydev/fig-cookies symfony/ldap:^4
- wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.10.3/php-cs-fixer.phar -O php-cs-fixer
- wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.16.1/php-cs-fixer.phar -O php-cs-fixer
- chmod +x ./php-cs-fixer
- mkdir -p tests/coverage

Expand Down
2 changes: 1 addition & 1 deletion src/Auth/Storage/Cookie.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function setUser(Root $user)
}
//@codeCoverageIgnoreEnd

return \Dflydev\FigCookies\Cookie::create('user_id', $user->getId());
return \Dflydev\FigCookies\Cookie::create('user_id', (string) $user->getId());
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/Auth/Repository/LDAPTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function testLogin(): void

public function testUniplemented(): void
{
$this->assertInternalType('string', $this->app->getContainer()->auth_repository->forgot('nevermind'));
$this->assertIsString($this->app->getContainer()->auth_repository->forgot('nevermind'));
$this->assertFalse($this->app->getContainer()->auth_repository->reset('nevermind', 'nevermind'));
}
}
2 changes: 1 addition & 1 deletion tests/Auth/Storage/CookieTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function testGetUserNull(): void

public function testGetUser(): void
{
$cookie = \Dflydev\FigCookies\Cookie::create('user_id', 1);
$cookie = \Dflydev\FigCookies\Cookie::create('user_id', '1');
$request = $this->app->getContainer()['request'];
unset($this->app->getContainer()['request']);
$this->app->getContainer()['request'] = \Dflydev\FigCookies\FigRequestCookies::set($request, $cookie);
Expand Down
4 changes: 2 additions & 2 deletions tests/Auth/Storage/JWTTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function testGetUserFromRequest(): void
{
$request = $this->app->getContainer()['request'];
unset($this->app->getContainer()['request']);
$this->app->getContainer()['request'] = $request->withAttribute('token', ['data' => ['login' => 'login']]);
$this->app->getContainer()['request'] = $request->withAttribute('token', ['data' => ['id' => 1, 'login' => 'login']]);
$this->assertInstanceOf('\Wtf\Root', $this->app->getContainer()->auth->getUser());
$this->assertEquals('login', $this->app->getContainer()->auth->getUser()->get('login'));
}
Expand All @@ -45,7 +45,7 @@ public function testLogin(): void
{
$this->assertNull($this->app->getContainer()->auth->login('notexist', 'password'));
$this->assertNull($this->app->getContainer()->auth->login('login', 'wrongpassword'));
$this->assertInternalType('string', $this->app->getContainer()->auth->login('login', 'me'));
$this->assertIsString($this->app->getContainer()->auth->login('login', 'me'));
}

public function testLogout(): void
Expand Down
6 changes: 3 additions & 3 deletions tests/Auth/Storage/SessionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function testGetUserNull(): void
public function testGetUser(): void
{
\session_start();
$_SESSION['user'] = ['login' => 'login'];
$_SESSION['user'] = ['id' => 1, 'login' => 'login'];

$this->assertInstanceOf('\Wtf\Root', $this->app->getContainer()->auth->getUser());
$this->assertEquals('login', $this->app->getContainer()->auth->getUser()->get('login'));
Expand Down Expand Up @@ -104,8 +104,8 @@ public function testLogout(): void
public function testForgot(): void
{
\session_start();
$this->assertInternalType('string', $this->app->getContainer()->auth->forgot('wrong'));
$this->assertInternalType('string', $this->app->getContainer()->auth->forgot('login'));
$this->assertIsString($this->app->getContainer()->auth->forgot('wrong'));
$this->assertIsString($this->app->getContainer()->auth->forgot('login'));
}

/**
Expand Down

0 comments on commit d1dc64b

Please sign in to comment.