diff --git a/.travis.yml b/.travis.yml
index 0c154e6..cae2c56 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -19,10 +19,10 @@ before_script:
script:
- vendor/bin/phpunit --configuration phpunit.xml.dist --colors
-jobs:
+matrix:
allow_failures:
- php: nightly
-
+jobs:
include:
- stage: Coding standards
script:
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index b981ef5..f51dbd9 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -5,4 +5,9 @@
tests
+
+
+ src
+
+
diff --git a/tests/CollectionTest.php b/tests/CollectionTest.php
index 2c861f5..f8155e6 100644
--- a/tests/CollectionTest.php
+++ b/tests/CollectionTest.php
@@ -4,8 +4,8 @@
namespace PHPFluent\ArrayStorage;
+use PHPFluent\ArrayStorage\Filter\Filter;
use PHPUnit\Framework\TestCase;
-use function count;
use function iterator_to_array;
/**
@@ -19,7 +19,7 @@ public function testShouldUseFactoryToCreateRecords(): void
$record = new Record($data);
$factory = $this
- ->getMockBuilder('PHPFluent\\ArrayStorage\\Factory')
+ ->getMockBuilder(Factory::class)
->disableOriginalConstructor()
->getMock();
@@ -37,11 +37,11 @@ public function testShouldUseFactoryToCreateRecords(): void
public function testShouldUseFactoryToCreateCriteria(): void
{
$factory = $this
- ->getMockBuilder('PHPFluent\\ArrayStorage\\Factory')
+ ->getMockBuilder(Factory::class)
->disableOriginalConstructor()
->getMock();
- $filters = ['foo' => $this->createMock('PHPFluent\\ArrayStorage\\Filter\\Filter')];
+ $filters = ['foo' => $this->createMock(Filter::class)];
$criteria = new Criteria($factory);
$criteria->addFilter('foo', $filters['foo']);
@@ -90,15 +90,15 @@ public function testShouldIterateOverRecords(): void
$collection->insert(new Record());
$collection->insert(new Record());
$collection->insert(new Record());
- $count = count(iterator_to_array($collection));
+ $count = iterator_to_array($collection);
- $this->assertEquals(3, $count);
+ $this->assertCount(3, $count);
}
public function testShouldReturnAnInstanceOfCollectionWhenFindingRecords(): void
{
$factory = $this
- ->getMockBuilder('PHPFluent\\ArrayStorage\\Factory')
+ ->getMockBuilder(Factory::class)
->disableOriginalConstructor()
->getMock();
diff --git a/tests/CriteriaTest.php b/tests/CriteriaTest.php
index f3fcd0e..9bbbf95 100644
--- a/tests/CriteriaTest.php
+++ b/tests/CriteriaTest.php
@@ -4,6 +4,7 @@
namespace PHPFluent\ArrayStorage;
+use PHPFluent\ArrayStorage\Filter\EqualTo;
use PHPFluent\ArrayStorage\Filter\Filter;
use PHPUnit\Framework\TestCase;
use UnexpectedValueException;
@@ -41,14 +42,14 @@ public function testShouldAddFilterUsingMethodOverload(): void
[$index, $filter] = $filters[0];
$this->assertEquals('foo', $index);
- $this->assertInstanceOf('PHPFluent\\ArrayStorage\\Filter\\EqualTo', $filter);
+ $this->assertInstanceOf(EqualTo::class, $filter);
}
public function testShouldUseFactoryToCreateFilters(): void
{
- $filter = $this->createMock('PHPFluent\\ArrayStorage\\Filter\\Filter');
+ $filter = $this->createMock(Filter::class);
- $factory = $this->createMock('PHPFluent\\ArrayStorage\\Factory');
+ $factory = $this->createMock(Factory::class);
$factory
->expects($this->once())
->method('filter')
diff --git a/tests/FactoryTest.php b/tests/FactoryTest.php
index a8b6689..136b4b5 100644
--- a/tests/FactoryTest.php
+++ b/tests/FactoryTest.php
@@ -28,13 +28,13 @@ public function testShouldCreateCollection(): void
{
$factory = new Factory();
- $this->assertInstanceOf('PHPFluent\\ArrayStorage\\Collection', $factory->collection());
+ $this->assertInstanceOf(Collection::class, $factory->collection());
}
public function testShouldReturnInputIfInputIsAlreadyCollection(): void
{
$collection = $this
- ->getMockBuilder('PHPFluent\\ArrayStorage\\Collection')
+ ->getMockBuilder(Collection::class)
->disableOriginalConstructor()
->getMock();
@@ -48,7 +48,7 @@ public function testShouldCreateNewRecord(): void
$factory = new Factory();
$record = $factory->record();
- $this->assertInstanceOf(__NAMESPACE__.'\\Record', $record);
+ $this->assertInstanceOf(Record::class, $record);
}
public function testShouldCreateNewRecordFromArray(): void
@@ -57,7 +57,7 @@ public function testShouldCreateNewRecordFromArray(): void
$data = [];
$record = $factory->record($data);
- $this->assertInstanceOf(__NAMESPACE__.'\\Record', $record);
+ $this->assertInstanceOf(Record::class, $record);
}
public function testShouldCreateNewRecordFromStdClass(): void
@@ -66,7 +66,7 @@ public function testShouldCreateNewRecordFromStdClass(): void
$data = new stdClass();
$record = $factory->record($data);
- $this->assertInstanceOf(__NAMESPACE__.'\\Record', $record);
+ $this->assertInstanceOf(Record::class, $record);
}
public function testShouldReturnTheSameInstanceWhenDataIsAlreadyRecordInstance(): void
@@ -83,13 +83,13 @@ public function testShouldCreateCriteria(): void
$factory = new Factory();
$criteria = $factory->criteria();
- $this->assertInstanceOf(__NAMESPACE__.'\\Criteria', $criteria);
+ $this->assertInstanceOf(Criteria::class, $criteria);
}
public function testShouldCreateCriteriaFromKeyValueArrayOfFilters(): void
{
$inputFilters = [
- 'foo' => $this->createMock(__NAMESPACE__.'\\Filter\\Filter'),
+ 'foo' => $this->createMock(Filter::class),
];
$factory = new Factory();
$criteria = $factory->criteria($inputFilters);
diff --git a/tests/RecordTest.php b/tests/RecordTest.php
index 7fe41a6..09f1a5b 100644
--- a/tests/RecordTest.php
+++ b/tests/RecordTest.php
@@ -5,7 +5,6 @@
namespace PHPFluent\ArrayStorage;
use PHPUnit\Framework\TestCase;
-use function count;
use function iterator_to_array;
/**
@@ -61,8 +60,6 @@ public function testShouldIterateOverRecord(): void
$record->id = 1;
$record->name = 'Henrique Moody';
- $count = count(iterator_to_array($record));
-
- $this->assertEquals(2, $count);
+ $this->assertCount(2, iterator_to_array($record));
}
}
diff --git a/tests/StorageTest.php b/tests/StorageTest.php
index 81bf93d..8c43c11 100644
--- a/tests/StorageTest.php
+++ b/tests/StorageTest.php
@@ -5,7 +5,6 @@
namespace PHPFluent\ArrayStorage;
use PHPUnit\Framework\TestCase;
-use function count;
use function iterator_to_array;
/**
@@ -18,13 +17,13 @@ public function testShouldGetCollectionWhenPropertyDoesNoExists(): void
$storage = new Storage();
$collection = $storage->whatever;
- $this->assertInstanceOf(__NAMESPACE__.'\\Collection', $collection);
+ $this->assertInstanceOf(Collection::class, $collection);
}
public function testShouldUseFactoryToCreateCollections(): void
{
$factory = $this
- ->getMockBuilder('PHPFluent\\ArrayStorage\\Factory')
+ ->getMockBuilder(Factory::class)
->disableOriginalConstructor()
->getMock();
$factory
@@ -50,8 +49,6 @@ public function testShouldIterateOverCollections(): void
$storage->foo;
$storage->bar;
- $count = count(iterator_to_array($storage));
-
- $this->assertEquals(2, $count);
+ $this->assertCount(2, iterator_to_array($storage));
}
}