/** * @dataProvider dataProviderForTestTypeValidity */ public function testRestrictToWithVariousRestrictions($type, $valid) { $collection = new Collection(); if (!is_null($valid)) { $collection->restrictTo($type, false); $this->assertEquals($valid, $collection->getType()); } else { $this->expectsException(function () use($collection, $type) { $collection->restrictTo($type); }, Exception::class, null, Exception::COLLECTION_INVALID_TYPE); } }