|
@ -115,7 +115,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { |
|
|
|
|
|
|
|
|
/** @dataProvider provideUserList */ |
|
|
/** @dataProvider provideUserList */ |
|
|
public function testListUsers(string $cmd, array $list, int $exitStatus, string $output) { |
|
|
public function testListUsers(string $cmd, array $list, int $exitStatus, string $output) { |
|
|
// Phake is somehow unable to mock the User class correctly, so we use PHPUnit's mocks instead |
|
|
// FIXME: Phake is somehow unable to mock the User class correctly, so we use PHPUnit's mocks instead |
|
|
Arsse::$user = $this->createMock(User::class); |
|
|
Arsse::$user = $this->createMock(User::class); |
|
|
Arsse::$user->method("list")->willReturn($list); |
|
|
Arsse::$user->method("list")->willReturn($list); |
|
|
$this->assertConsole(new CLI, $cmd, $exitStatus, $output); |
|
|
$this->assertConsole(new CLI, $cmd, $exitStatus, $output); |
|
@ -134,7 +134,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { |
|
|
|
|
|
|
|
|
/** @dataProvider provideUserAdditions */ |
|
|
/** @dataProvider provideUserAdditions */ |
|
|
public function testAddAUser(string $cmd, int $exitStatus, string $output) { |
|
|
public function testAddAUser(string $cmd, int $exitStatus, string $output) { |
|
|
// Phake is somehow unable to mock the User class correctly, so we use PHPUnit's mocks instead |
|
|
// FIXME: Phake is somehow unable to mock the User class correctly, so we use PHPUnit's mocks instead |
|
|
Arsse::$user = $this->createMock(User::class); |
|
|
Arsse::$user = $this->createMock(User::class); |
|
|
Arsse::$user->method("add")->will($this->returnCallback(function($user, $pass = null) { |
|
|
Arsse::$user->method("add")->will($this->returnCallback(function($user, $pass = null) { |
|
|
switch ($user) { |
|
|
switch ($user) { |
|
@ -157,7 +157,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { |
|
|
|
|
|
|
|
|
/** @dataProvider provideUserAuthentication */ |
|
|
/** @dataProvider provideUserAuthentication */ |
|
|
public function testAuthenticateAUser(string $cmd, int $exitStatus, string $output) { |
|
|
public function testAuthenticateAUser(string $cmd, int $exitStatus, string $output) { |
|
|
// Phake is somehow unable to mock the User class correctly, so we use PHPUnit's mocks instead |
|
|
// FIXME: Phake is somehow unable to mock the User class correctly, so we use PHPUnit's mocks instead |
|
|
Arsse::$user = $this->createMock(User::class); |
|
|
Arsse::$user = $this->createMock(User::class); |
|
|
Arsse::$user->method("auth")->will($this->returnCallback(function($user, $pass) { |
|
|
Arsse::$user->method("auth")->will($this->returnCallback(function($user, $pass) { |
|
|
return ( |
|
|
return ( |
|
@ -180,7 +180,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { |
|
|
|
|
|
|
|
|
/** @dataProvider provideUserRemovals */ |
|
|
/** @dataProvider provideUserRemovals */ |
|
|
public function testRemoveAUser(string $cmd, int $exitStatus, string $output) { |
|
|
public function testRemoveAUser(string $cmd, int $exitStatus, string $output) { |
|
|
// Phake is somehow unable to mock the User class correctly, so we use PHPUnit's mocks instead |
|
|
// FIXME: Phake is somehow unable to mock the User class correctly, so we use PHPUnit's mocks instead |
|
|
Arsse::$user = $this->createMock(User::class); |
|
|
Arsse::$user = $this->createMock(User::class); |
|
|
Arsse::$user->method("remove")->will($this->returnCallback(function($user) { |
|
|
Arsse::$user->method("remove")->will($this->returnCallback(function($user) { |
|
|
if ($user == "john.doe@example.com") { |
|
|
if ($user == "john.doe@example.com") { |
|
@ -200,7 +200,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { |
|
|
|
|
|
|
|
|
/** @dataProvider provideUserPasswordChanges */ |
|
|
/** @dataProvider provideUserPasswordChanges */ |
|
|
public function testChangeAUserPassword(string $cmd, int $exitStatus, string $output) { |
|
|
public function testChangeAUserPassword(string $cmd, int $exitStatus, string $output) { |
|
|
// Phake is somehow unable to mock the User class correctly, so we use PHPUnit's mocks instead |
|
|
// FIXME: Phake is somehow unable to mock the User class correctly, so we use PHPUnit's mocks instead |
|
|
Arsse::$user = $this->createMock(User::class); |
|
|
Arsse::$user = $this->createMock(User::class); |
|
|
Arsse::$user->method("passwordSet")->will($this->returnCallback(function($user, $pass = null) { |
|
|
Arsse::$user->method("passwordSet")->will($this->returnCallback(function($user, $pass = null) { |
|
|
switch ($user) { |
|
|
switch ($user) { |
|
|