Skip to content

Commit cd8e01b

Browse files
committed
Got initial tests going
1 parent 332305c commit cd8e01b

File tree

3 files changed

+48
-1
lines changed

3 files changed

+48
-1
lines changed

composer.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,14 @@
1616
"doctrine/orm": "2.5.*",
1717
"doctrine/migrations": "1.*"
1818
},
19+
"require-dev": {
20+
"mockery/mockery": "dev-master",
21+
"phpunit/phpunit": "3.7.*"
22+
},
1923
"autoload": {
2024
"psr-4": {
21-
"Mitch\\LaravelDoctrine\\": "src/"
25+
"Mitch\\LaravelDoctrine\\": "src/",
26+
"Tests\\": "tests/"
2227
}
2328
},
2429
"minimum-stability": "dev"

phpunit.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit backupGlobals="false"
3+
backupStaticAttributes="false"
4+
bootstrap="vendor/autoload.php"
5+
colors="true"
6+
convertErrorsToExceptions="true"
7+
convertNoticesToExceptions="true"
8+
convertWarningsToExceptions="true"
9+
processIsolation="false"
10+
stopOnFailure="false"
11+
syntaxCheck="false"
12+
>
13+
<testsuites>
14+
<testsuite name="all">
15+
<directory suffix="Test.php">./tests/</directory>
16+
</testsuite>
17+
</testsuites>
18+
</phpunit>

tests/DriverMapperTest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php namespace Tests;
2+
3+
use Mitch\LaravelDoctrine\Configuration\DriverMapper;
4+
use Mockery as m;
5+
6+
class DriverMapperTest extends \PHPUnit_Framework_TestCase
7+
{
8+
public function testUsageOfCorrectConfigurationMapper()
9+
{
10+
$mockMapper1 = m::mock('Mitch\LaravelDoctrine\Configuration\Mapper');
11+
$mockMapper2 = m::mock('Mitch\LaravelDoctrine\Configuration\Mapper');
12+
13+
$driverMapper = new DriverMapper('some driver');
14+
15+
$driverMapper->registerMapper($mockMapper1);
16+
$driverMapper->registerMapper($mockMapper2);
17+
18+
$mockMapper1->shouldReceive('appropriate')->once()->andReturn(false);
19+
$mockMapper2->shouldReceive('appropriate')->once()->andReturn(true);
20+
$mockMapper2->shouldReceive('map')->once()->andReturn('mapped array');
21+
22+
$this->assertEquals('mapped array', $driverMapper->map([]));
23+
}
24+
}

0 commit comments

Comments
 (0)