/** * @covers phpDocumentor\Plugin\Core\Descriptor\Validator\Constraints\Classes\HasSinglePackageValidator::validate */ public function testValidateSinglePackage() { $packageCollection = new Collection(array('x')); $tagCollection = new Collection(array('package' => $packageCollection)); $this->fileDescriptor->shouldReceive('getTags')->andReturn($tagCollection)->once(); $this->context->shouldReceive('addViolationAt')->never(); $this->validator->validate($this->fileDescriptor, $this->constraint); }
/** * @codingStandardsIgnoreStart * @covers phpDocumentor\Plugin\Core\Descriptor\Validator\Constraints\Classes\HasPackageWithSubpackageValidator::validate * @codingStandardsIgnoreEnd */ public function testValidateSubpackageWithPackage() { $packageCollection = new Collection(array('x')); $subpackageCollection = new Collection(array('y')); $tagPackageCollection = new Collection(array('package' => $packageCollection, 'subpackage' => $subpackageCollection)); $this->fileDescriptor->shouldReceive('getTags')->andReturn($tagPackageCollection)->twice(); $this->context->shouldReceive('addViolationAt')->never(); $this->validator->validate($this->fileDescriptor, $this->constraint); $this->assertTrue(true); }