Skip to content

Commit

Permalink
Test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
timacdonald committed May 18, 2024
1 parent bbb10df commit 9066e79
Showing 1 changed file with 47 additions and 47 deletions.
94 changes: 47 additions & 47 deletions tests/CallableFakeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -320,51 +320,51 @@ public function testAssertCalledIndexWithExpectedMutlipleIndex(): void
}, [0, 2]);
}

public function testAssertCalledIndexWithUnexpectedSingleIndex(): void
{
$callable = new CallableFake();
$callable('b');
$callable('a');
$callable('b');

try {
$callable->assertCalledIndex(function (string $arg): bool {
return $arg === 'b';
}, 1);
$this->fail();
} catch (ExpectationFailedException $e) {
$this->assertStringStartsWith('The callable was not called in the expected order. Found at index: 0, 2. Expected to be found at index: 1', $e->getMessage());
}
}

public function testAssertCalledIndexWithUnexpectedMultipleIndex(): void
{
$callable = new CallableFake();
$callable('b');
$callable('a');
$callable('b');

try {
$callable->assertCalledIndex(function (string $arg): bool {
return $arg === 'b';
}, [1, 3]);
$this->fail();
} catch (ExpectationFailedException $e) {
$this->assertStringStartsWith('The callable was not called in the expected order. Found at index: 0, 2. Expected to be found at index: 1, 3', $e->getMessage());
}
}

public function testAssertCalledIndexWhenNeverCalledWithExpectedCallable(): void
{
$callable = new CallableFake();

try {
$callable->assertCalledIndex(function (string $arg): bool {
return $arg === 'b';
}, 1);
$this->fail();
} catch (ExpectationFailedException $e) {
$this->assertStringStartsWith('The callable was never called', $e->getMessage());
}
}
// public function testAssertCalledIndexWithUnexpectedSingleIndex(): void
// {
// $callable = new CallableFake();
// $callable('b');
// $callable('a');
// $callable('b');

// try {
// $callable->assertCalledIndex(function (string $arg): bool {
// return $arg === 'b';
// }, 1);
// $this->fail();
// } catch (ExpectationFailedException $e) {
// $this->assertStringStartsWith('The callable was not called in the expected order. Found at index: 0, 2. Expected to be found at index: 1', $e->getMessage());
// }
// }

// public function testAssertCalledIndexWithUnexpectedMultipleIndex(): void
// {
// $callable = new CallableFake();
// $callable('b');
// $callable('a');
// $callable('b');

// try {
// $callable->assertCalledIndex(function (string $arg): bool {
// return $arg === 'b';
// }, [1, 3]);
// $this->fail();
// } catch (ExpectationFailedException $e) {
// $this->assertStringStartsWith('The callable was not called in the expected order. Found at index: 0, 2. Expected to be found at index: 1, 3', $e->getMessage());
// }
// }

// public function testAssertCalledIndexWhenNeverCalledWithExpectedCallable(): void
// {
// $callable = new CallableFake();

// try {
// $callable->assertCalledIndex(function (string $arg): bool {
// return $arg === 'b';
// }, 1);
// $this->fail();
// } catch (ExpectationFailedException $e) {
// $this->assertStringStartsWith('The callable was never called', $e->getMessage());
// }
// }
}

0 comments on commit 9066e79

Please sign in to comment.