Skip to content

Commit cc396e2

Browse files
authored
Merge pull request #3 from jncarver/master
ReadOnlyViolationException and ConfigurationException
2 parents 2ecd31c + c9702b5 commit cc396e2

File tree

4 files changed

+76
-0
lines changed

4 files changed

+76
-0
lines changed

src/ConfigurationException.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
namespace TraderInteractive\Exceptions;
4+
5+
use RuntimeException;
6+
7+
/**
8+
* Exception thrown when there is an issue with a configuration file.
9+
*/
10+
class ConfigurationException extends RuntimeException
11+
{
12+
}

src/ReadOnlyViolationException.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
namespace TraderInteractive\Exceptions;
4+
5+
use RuntimeException;
6+
7+
/**
8+
* Exception thrown when trying to write to a read-only value.
9+
*/
10+
class ReadOnlyViolationException extends RuntimeException
11+
{
12+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
namespace TraderInteractiveTest\Exceptions;
4+
5+
use PHPUnit\Framework\TestCase;
6+
use TraderInteractive\Exceptions\ConfigurationException;
7+
8+
/**
9+
* @coversDefaultClass \TraderInteractive\Exceptions\ConfigurationException
10+
*/
11+
final class ConfigurationExceptionTest extends TestCase
12+
{
13+
/**
14+
* @test
15+
*
16+
* @return void
17+
*/
18+
public function basicUsage()
19+
{
20+
$expected = 'There is something wrong here...';
21+
$exception = new ConfigurationException($expected);
22+
23+
$actual = $exception->getMessage();
24+
$this->assertSame($expected, $actual);
25+
}
26+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
namespace TraderInteractiveTest\Exceptions;
4+
5+
use PHPUnit\Framework\TestCase;
6+
use TraderInteractive\Exceptions\ReadOnlyViolationException;
7+
8+
/**
9+
* @coversDefaultClass \TraderInteractive\Exceptions\ReadOnlyViolationException
10+
*/
11+
final class ReadOnlyViolationExceptionTest extends TestCase
12+
{
13+
/**
14+
* @test
15+
*
16+
* @return void
17+
*/
18+
public function basicUsage()
19+
{
20+
$expected = 'You cannot do that.';
21+
$exception = new ReadOnlyViolationException($expected);
22+
23+
$actual = $exception->getMessage();
24+
$this->assertSame($expected, $actual);
25+
}
26+
}

0 commit comments

Comments
 (0)