/** * test, if configuration overwrites default values * * @dataProvider providerTestFactory */ public function testFactory($config) { $serviceManager = new ServiceManager(); $serviceManager->setService('Config', $config); $factory = new ModuleOptionsFactory(); $defaultOption = new ModuleOptions(array()); $object = $factory->createService($serviceManager); $this->assertInstanceOf('Applications\\Options\\ModuleOptions', $object); if (isset($config['application_options'])) { $this->assertNotEquals($defaultOption->getAttachmentsMaxSize(), $object->getAttachmentsMaxSize()); $this->assertEquals($config['application_options']['attachmentsMaxSize'], $object->getAttachmentsMaxSize()); } else { $this->assertEquals($defaultOption->getAttachmentsMaxSize(), $object->getAttachmentsMaxSize()); } }
/** * @covers ::setAllowSubsequentAttachmentUpload * @covers ::getAllowSubsequentAttachmentUpload */ public function testSetGetAllowSubsequentAttachmentUpload() { $this->assertFalse($this->options->getAllowSubsequentAttachmentUpload()); $this->options->setAllowSubsequentAttachmentUpload(true); $this->assertTrue($this->options->getAllowSubsequentAttachmentUpload()); $this->options->setAllowSubsequentAttachmentUpload('1'); $this->assertTrue($this->options->getAllowSubsequentAttachmentUpload()); $this->options->setAllowSubsequentAttachmentUpload(false); $this->assertFalse($this->options->getAllowSubsequentAttachmentUpload()); $this->options->setAllowSubsequentAttachmentUpload('0'); $this->assertFalse($this->options->getAllowSubsequentAttachmentUpload()); }
/** * @covers Applications\Options\ModuleOptions::getContactImageMaxSize * @covers Applications\Options\ModuleOptions::setContactImageMaxSize */ public function testSetGetAllowedMimeTypes() { $mime = array('image', 'application/pdf'); $this->options->setAllowedMimeTypes($mime); $this->assertEquals($mime, $this->options->getAllowedMimeTypes()); }