Skip to content

Commit 253859b

Browse files
committed
Refactoring tests
1 parent 01491eb commit 253859b

File tree

6 files changed

+18
-19
lines changed

6 files changed

+18
-19
lines changed

tests/Doctrine/ODM/MongoDB/Tests/Functional/FilesTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function testFiles()
3939
$this->assertInstanceOf('Doctrine\MongoDB\GridFSFile', $image->getFile());
4040
$this->assertFalse($image->getFile()->isDirty());
4141
$this->assertEquals(__DIR__ . '/file.txt', $image->getFile()->getFilename());
42-
$this->assertTrue(file_exists($image->getFile()->getFilename()));
42+
$this->assertFileExists($image->getFile()->getFilename());
4343
$this->assertEquals('These are the bytes...', $image->getFile()->getBytes());
4444

4545
$image->setName('testing');

tests/Doctrine/ODM/MongoDB/Tests/Functional/FunctionalTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -379,8 +379,8 @@ public function testIncrementSetsNull()
379379
$this->dm->clear();
380380

381381
$user = $this->dm->getRepository('Documents\User')->findOneBy(array('username' => 'jon'));
382-
$this->assertSame(null, $user->getCount());
383-
$this->assertSame(null, $user->getFloatCount());
382+
$this->assertNull($user->getCount());
383+
$this->assertNull($user->getFloatCount());
384384
}
385385

386386
public function testTest()

tests/Doctrine/ODM/MongoDB/Tests/Functional/Ticket/GH816Test.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,22 @@ public function testPersistAfterDetachWithIdSet()
1010
{
1111
$d=new GH816Document();
1212
$d->_id=new \MongoId();
13-
$this->assertSame(array(), $this->dm->getRepository('Doctrine\ODM\MongoDB\Tests\GH816Document')->findAll());
13+
$this->assertEmpty($this->dm->getRepository('Doctrine\ODM\MongoDB\Tests\GH816Document')->findAll());
1414
$this->dm->persist($d);
1515
$this->dm->detach($d);
1616
$this->dm->flush();
17-
$this->assertSame(array(), $this->dm->getRepository('Doctrine\ODM\MongoDB\Tests\GH816Document')->findAll());
17+
$this->assertEmpty($this->dm->getRepository('Doctrine\ODM\MongoDB\Tests\GH816Document')->findAll());
1818
}
19-
19+
2020
public function testPersistAfterDetachWithTitleSet()
2121
{
2222
$d=new GH816Document();
2323
$d->title="Test";
24-
$this->assertSame(array(), $this->dm->getRepository('Doctrine\ODM\MongoDB\Tests\GH816Document')->findAll());
24+
$this->assertEmpty($this->dm->getRepository('Doctrine\ODM\MongoDB\Tests\GH816Document')->findAll());
2525
$this->dm->persist($d);
2626
$this->dm->detach($d);
2727
$this->dm->flush();
28-
$this->assertSame(array(), $this->dm->getRepository('Doctrine\ODM\MongoDB\Tests\GH816Document')->findAll());
28+
$this->assertEmpty($this->dm->getRepository('Doctrine\ODM\MongoDB\Tests\GH816Document')->findAll());
2929
}
3030
}
3131

@@ -36,7 +36,7 @@ class GH816Document
3636
{
3737
/** @ODM\Id */
3838
public $_id;
39-
39+
4040
/** @ODM\Field(type="string") */
4141
public $title;
4242
}

tests/Doctrine/ODM/MongoDB/Tests/HydratorTest.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function testHydrator()
3333
));
3434

3535
$this->assertEquals(1, $user->id);
36-
$this->assertSame(null, $user->title);
36+
$this->assertNull($user->title);
3737
$this->assertEquals('jon', $user->name);
3838
$this->assertInstanceOf('DateTime', $user->birthdate);
3939
$this->assertInstanceOf(__NAMESPACE__.'\HydrationClosureReferenceOne', $user->referenceOne);
@@ -44,7 +44,7 @@ public function testHydrator()
4444
$this->assertEquals('jon', $user->embedOne->name);
4545
$this->assertEquals('jon', $user->embedMany[0]->name);
4646
}
47-
47+
4848
public function testReadOnly()
4949
{
5050
$class = $this->dm->getClassMetadata(__NAMESPACE__.'\HydrationClosureUser');
@@ -59,7 +59,7 @@ public function testReadOnly()
5959
['name' => 'maciej']
6060
],
6161
], [ Query::HINT_READ_ONLY => true ]);
62-
62+
6363
$this->assertFalse($this->uow->isInIdentityMap($user));
6464
$this->assertFalse($this->uow->isInIdentityMap($user->embedOne));
6565
$this->assertFalse($this->uow->isInIdentityMap($user->embedMany[0]));
@@ -77,7 +77,7 @@ class HydrationClosureUser
7777

7878
/** @ODM\Field(type="string") */
7979
public $name;
80-
80+
8181
/** @ODM\Field(type="date") */
8282
public $birthdate;
8383

tests/Doctrine/ODM/MongoDB/Tests/Mapping/Driver/XmlDriverTest.php

+4-5
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,16 @@ public function testDriverShouldParseNonStringAttributes()
4343
$classMetadata = new ClassMetadata('TestDocuments\UserNonStringOptions');
4444
$this->driver->loadMetadataForClass('TestDocuments\UserNonStringOptions', $classMetadata);
4545

46-
$this->assertSame(true, $classMetadata->requireIndexes);
47-
$this->assertSame(false, $classMetadata->slaveOkay);
46+
$this->assertTrue($classMetadata->requireIndexes);
47+
$this->assertFalse($classMetadata->slaveOkay);
4848

4949
$profileMapping = $classMetadata->fieldMappings['profile'];
5050
$this->assertSame(ClassMetadataInfo::REFERENCE_STORE_AS_ID, $profileMapping['storeAs']);
51-
$this->assertSame(true, $profileMapping['orphanRemoval']);
51+
$this->assertTrue($profileMapping['orphanRemoval']);
5252

5353
$profileMapping = $classMetadata->fieldMappings['groups'];
5454
$this->assertSame(ClassMetadataInfo::REFERENCE_STORE_AS_DB_REF_WITH_DB, $profileMapping['storeAs']);
55-
$this->assertSame(false, $profileMapping['orphanRemoval']);
55+
$this->assertFalse($profileMapping['orphanRemoval']);
5656
$this->assertSame(0, $profileMapping['limit']);
5757
$this->assertSame(2, $profileMapping['skip']);
5858
}
@@ -92,4 +92,3 @@ class UserNonStringOptions
9292
protected $profile;
9393
protected $groups;
9494
}
95-

tests/Doctrine/ODM/MongoDB/Tests/Query/FilterCollectionTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function testGetFilterCriteria()
6363
$class = $this->dm->getClassMetadata('Documents\User');
6464
$filterCollection = $this->dm->getFilterCollection();
6565

66-
$this->assertSame(array(), $filterCollection->getFilterCriteria($class));
66+
$this->assertEmpty($filterCollection->getFilterCriteria($class));
6767

6868
$filterCollection->enable('testFilter');
6969
$testFilter = $filterCollection->getFilter('testFilter');

0 commit comments

Comments
 (0)