Skip to content

Commit 45a36fa

Browse files
authored
Fix build (#8)
1 parent bbee212 commit 45a36fa

5 files changed

+32
-29
lines changed

.travis.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ php:
66
- 5.6
77
- 7.0
88
- 7.1
9+
- 7.2
910
- hhvm
1011

1112
matrix:
@@ -18,8 +19,12 @@ matrix:
1819
- COVERAGE=true
1920
- PHPUNIT_FLAGS="--coverage-clover=coverage.clover"
2021

22+
before_install:
23+
- if [[ ${TRAVIS_PHP_VERSION:0:2} == "5." ]]; then echo "extension = mongo.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi
24+
- if [[ ${TRAVIS_PHP_VERSION:0:2} == "7." ]]; then echo "extension = mongodb.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi
25+
- if [[ ${TRAVIS_PHP_VERSION:0:2} == "7." ]]; then composer require alcaeus/mongo-php-adapter --ignore-platform-reqs; fi
26+
2127
install:
22-
- phpenv config-add travis-php.ini
2328
- travis_retry composer update ${COMPOSER_FLAGS} --prefer-source --no-interaction
2429

2530
script:

composer.json

+3-4
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
},
1515
{
1616
"name": "Community contributors",
17-
"homepage": "https://github.com/portphp/doctrine-adapter/graphs/contributors"
17+
"homepage": "https://github.com/portphp/doctrine/graphs/contributors"
1818
}
1919
],
2020
"support": {
2121
"issues": "https://github.com/portphp/portphp/issues",
22-
"source": "https://github.com/portphp/doctrine-adapter",
22+
"source": "https://github.com/portphp/doctrine",
2323
"docs": "https://portphp.readthedocs.org"
2424
},
2525
"require": {
@@ -28,10 +28,9 @@
2828
"doctrine/common": "^2.2"
2929
},
3030
"require-dev": {
31-
"phpunit/phpunit": "4.7.*",
31+
"phpunit/phpunit": "^5.2",
3232
"ext-sqlite3": "*",
3333
"doctrine/orm": "~2.4",
34-
"doctrine/mongodb": "^1.2",
3534
"doctrine/mongodb-odm": "^1.0"
3635
},
3736
"autoload": {

tests/DoctrineReaderTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ protected function getReader()
4343

4444
$em->flush();
4545

46-
return new DoctrineReader($em, 'Port\Tests\Fixtures\Entity\User');
46+
return new DoctrineReader($em, 'Port\Doctrine\Tests\Fixtures\Entity\User');
4747
}
4848

4949
protected function getEntityManager()
@@ -62,7 +62,7 @@ protected function getEntityManager()
6262
$schemaTool = new \Doctrine\ORM\Tools\SchemaTool($em);
6363
$schemaTool->createSchema(
6464
array(
65-
$em->getMetadataFactory()->getMetadataFor('Port\Tests\Fixtures\Entity\User')
65+
$em->getMetadataFactory()->getMetadataFor('Port\Doctrine\Tests\Fixtures\Entity\User')
6666
)
6767
);
6868

tests/DoctrineWriterTest.php

+21-21
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,16 @@
77

88
class DoctrineWriterTest extends \PHPUnit_Framework_TestCase
99
{
10+
const TEST_ENTITY = 'Port\Doctrine\Tests\Fixtures\Entity\TestEntity';
11+
1012
public function testWriteItem()
1113
{
1214
$em = $this->getEntityManager();
1315

1416
$em->expects($this->once())
1517
->method('persist');
1618

17-
$writer = new DoctrineWriter($em, 'DdeboerPort:TestEntity');
19+
$writer = new DoctrineWriter($em, 'Port:TestEntity');
1820

1921
$association = new TestEntity();
2022
$item = array(
@@ -24,15 +26,15 @@ public function testWriteItem()
2426
);
2527
$writer->writeItem($item);
2628
}
27-
29+
2830
public function testWriteItemMongodb()
2931
{
3032
$em = $this->getMongoDocumentManager();
3133

3234
$em->expects($this->once())
3335
->method('persist');
3436

35-
$writer = new DoctrineWriter($em, 'DdeboerPort:TestEntity');
37+
$writer = new DoctrineWriter($em, 'Port:TestEntity');
3638

3739
$association = new TestEntity();
3840
$item = array(
@@ -43,12 +45,13 @@ public function testWriteItemMongodb()
4345
$writer->prepare();
4446
$writer->writeItem($item);
4547
}
46-
48+
4749
public function testUnsupportedDatabaseTypeException()
4850
{
49-
$this->setExpectedException('Port\Doctrine\Exception\UnsupportedDatabaseTypeException');
50-
$em = $this->getMock('Doctrine\Common\Persistence\ObjectManager');
51-
new DoctrineWriter($em, 'DdeboerPort:TestEntity');
51+
$this->expectException('Port\Doctrine\Exception\UnsupportedDatabaseTypeException');
52+
$em = $this->getMockBuilder('Doctrine\Common\Persistence\ObjectManager')
53+
->getMock();
54+
new DoctrineWriter($em, 'Port:TestEntity');
5255
}
5356

5457
protected function getEntityManager()
@@ -69,7 +72,7 @@ protected function getEntityManager()
6972

7073
$metadata->expects($this->any())
7174
->method('getName')
72-
->will($this->returnValue('Port\Tests\Fixtures\Entity\TestEntity'));
75+
->will($this->returnValue(self::TEST_ENTITY));
7376

7477
$metadata->expects($this->any())
7578
->method('getFieldNames')
@@ -81,7 +84,7 @@ protected function getEntityManager()
8184

8285
$metadata->expects($this->any())
8386
->method('getAssociationMappings')
84-
->will($this->returnValue(array(array('fieldName' => 'firstAssociation','targetEntity' => 'Port\Tests\Fixtures\Entity\TestEntity'))));
87+
->will($this->returnValue(array(array('fieldName' => 'firstAssociation','targetEntity' => self::TEST_ENTITY))));
8588

8689
$configuration = $this->getMockBuilder('Doctrine\DBAL\Configuration')
8790
->setMethods(array('getConnection'))
@@ -108,10 +111,7 @@ protected function getEntityManager()
108111
$connection->expects($this->any())
109112
->method('executeQuery')
110113
->with('TRUNCATE SQL');
111-
112-
$em->expects($this->never())
113-
->method('getDocumentCollection');
114-
114+
115115
$em->expects($this->once())
116116
->method('getRepository')
117117
->will($this->returnValue($repo));
@@ -134,7 +134,7 @@ protected function getEntityManager()
134134

135135
return $em;
136136
}
137-
137+
138138

139139
protected function getMongoDocumentManager()
140140
{
@@ -154,7 +154,7 @@ protected function getMongoDocumentManager()
154154

155155
$metadata->expects($this->any())
156156
->method('getName')
157-
->will($this->returnValue('Port\Tests\Fixtures\Entity\TestEntity'));
157+
->will($this->returnValue(self::TEST_ENTITY));
158158

159159
$metadata->expects($this->any())
160160
->method('getFieldNames')
@@ -163,10 +163,10 @@ protected function getMongoDocumentManager()
163163
$metadata->expects($this->any())
164164
->method('getAssociationNames')
165165
->will($this->returnValue(array('firstAssociation')));
166-
166+
167167
$metadata->expects($this->any())
168168
->method('getAssociationMappings')
169-
->will($this->returnValue(array(array('fieldName' => 'firstAssociation','targetEntity' => 'Port\Tests\Fixtures\Entity\TestEntity'))));
169+
->will($this->returnValue(array(array('fieldName' => 'firstAssociation','targetEntity' => self::TEST_ENTITY))));
170170

171171
$configuration = $this->getMockBuilder('Doctrine\DBAL\Configuration')
172172
->setMethods(array('getConnection'))
@@ -237,7 +237,7 @@ public function testLoadAssociationWithoutObject()
237237
$em->expects($this->once())
238238
->method('getReference');
239239

240-
$writer = new DoctrineWriter($em, 'DdeboerPort:TestEntity');
240+
$writer = new DoctrineWriter($em, 'Port:TestEntity');
241241

242242
$item = array(
243243
'firstProperty' => 'some value',
@@ -258,7 +258,7 @@ public function testLoadAssociationWithPresetObject()
258258
$em->expects($this->never())
259259
->method('getReference');
260260

261-
$writer = new DoctrineWriter($em, 'DdeboerPort:TestEntity');
261+
$writer = new DoctrineWriter($em, 'Port:TestEntity');
262262

263263
$association = new TestEntity();
264264
$item = array(
@@ -279,9 +279,9 @@ public function testFlushAndClear()
279279

280280
$em->expects($this->once())
281281
->method('clear')
282-
->with($this->equalTo('Port\Tests\Fixtures\Entity\TestEntity'));
282+
->with($this->equalTo(self::TEST_ENTITY));
283283

284-
$writer = new DoctrineWriter($em, 'DdeboerPort:TestEntity');
284+
$writer = new DoctrineWriter($em, 'Port:TestEntity');
285285
$writer->finish();
286286
}
287287
}

travis-php.ini

-1
This file was deleted.

0 commit comments

Comments
 (0)