Exemplo n.º 1
0
 protected function setup()
 {
     if (!self::$stackInitialized) {
         if (ezcBaseFeatures::hasExtensionSupport('apc')) {
             $memoryStorage = new ezcCacheStorageApcPlain();
         } else {
             if (ezcBaseFeatures::hasExtensionSupport('memcache')) {
                 $memoryStorage = new ezcCacheStorageMemcachePlain('foo');
             } else {
                 $this->markTestSkipped('APC or Memcached needed to run this test.');
             }
         }
         // Start cleanly
         $memoryStorage->reset();
         $tmpDir = $this->createTempDir(__CLASS__);
         $tmpDirEvalArray = "{$tmpDir}/plain";
         $tmpDirArray = "{$tmpDir}/array";
         mkdir($tmpDirEvalArray);
         mkdir($tmpDirArray);
         $fileStorageEvalArray = new ezcCacheStorageFileEvalArray($tmpDirEvalArray);
         $fileStorageArray = new ezcCacheStorageFileArray($tmpDirArray);
         ezcCacheStackTestConfigurator::reset();
         ezcCacheStackTestConfigurator::$storages = array(new ezcCacheStackStorageConfiguration('eval_array_storage', $fileStorageEvalArray, 10, 0.8), new ezcCacheStackStorageConfiguration('array_storage', $fileStorageArray, 8, 0.5), new ezcCacheStackStorageConfiguration('memory_storage', $memoryStorage, 5, 0.5));
         ezcCacheStackTestConfigurator::$metaStorage = $fileStorageArray;
         ezcCacheManager::createCache(__CLASS__, null, 'ezcCacheStack', new ezcCacheStackOptions(array('configurator' => 'ezcCacheStackTestConfigurator', 'replacementStrategy' => 'ezcCacheStackLfuReplacementStrategy')));
         self::$stackInitialized = true;
     }
     $this->testDataArray = array(array('id_1', 'id_1_content', array('lang' => 'en', 'area' => 'news')), array('id_2', 'id_2_content', array('lang' => 'en', 'area' => 'news')), array('id_3', 'id_3_content', array('lang' => 'de', 'area' => 'news')), array('id_4', 'id_4_content', array('lang' => 'no', 'area' => 'news')), array('id_5', 'id_5_content', array('lang' => 'de', 'area' => 'news')));
 }
Exemplo n.º 2
0
 protected function setUp()
 {
     if (!ezcBaseFeatures::hasExtensionSupport('exif')) {
         $this->markTestSkipped('ext/exif is required to run this test.');
     }
     $this->basePath = dirname(__FILE__) . '/data/';
 }
Exemplo n.º 3
0
 /**
  * Creates a new big number library which uses the PHP extension $lib.
  *
  * If $lib is null then an autodetection of the library is tried. If neither
  * gmp or bcmath are installed then an exception will be thrown.
  *
  * If $lib is specified, then that library will be used (if it is installed),
  * otherwise an exception will be thrown.
  *
  * @throws ezcBaseExtensionNotFoundException
  *         if neither of the PHP gmp and bcmath extensions are installed ($lib === null),
  *         or if the specified $lib is not installed
  * @throws ezcBaseValueException
  *         if the value provided for $lib is not correct
  * @param string $lib The PHP library to use for big number support. Default
  *                    is null, which means the available library is autodetected.
  * @return ezcAuthenticationBignumLibrary
  */
 public static function createBignumLibrary($lib = null)
 {
     $library = null;
     switch ($lib) {
         case null:
             if (!ezcBaseFeatures::hasExtensionSupport('bcmath')) {
                 if (!ezcBaseFeatures::hasExtensionSupport('gmp')) {
                     throw new ezcBaseExtensionNotFoundException('gmp | bcmath', null, "PHP not compiled with --enable-bcmath or --with-gmp.");
                 } else {
                     $library = new ezcAuthenticationGmpLibrary();
                 }
             } else {
                 $library = new ezcAuthenticationBcmathLibrary();
             }
             break;
         case 'gmp':
             if (!ezcBaseFeatures::hasExtensionSupport('gmp')) {
                 throw new ezcBaseExtensionNotFoundException('gmp', null, "PHP not compiled with --with-gmp.");
             }
             $library = new ezcAuthenticationGmpLibrary();
             break;
         case 'bcmath':
             if (!ezcBaseFeatures::hasExtensionSupport('bcmath')) {
                 throw new ezcBaseExtensionNotFoundException('bcmath', null, "PHP not compiled with --enable-bcmath.");
             }
             $library = new ezcAuthenticationBcmathLibrary();
             break;
         default:
             throw new ezcBaseValueException('library', $lib, '"gmp" || "bcmath" || null');
     }
     return $library;
 }
Exemplo n.º 4
0
 /**
  * Construct converter
  *
  * Construct converter from XSLT file, which is used for the actual
  * conversion.
  *
  * @param ezcDocumentXsltConverterOptions $options
  * @return void
  */
 public function __construct(ezcDocumentXsltConverterOptions $options = null)
 {
     if (!ezcBaseFeatures::hasExtensionSupport('xsl')) {
         throw new ezcBaseExtensionNotFoundException('xsl');
     }
     parent::__construct($options === null ? new ezcDocumentXsltConverterOptions() : $options);
 }
Exemplo n.º 5
0
 /**
  * Constructs a new ezcCacheMemcacheBackend object.
  *
  * For options for this backend see {@link ezcCacheStorageMemcacheOptions}.
  *
  * @throws ezcBaseExtensionNotFoundException
  *         If the PHP memcache and zlib extensions are not installed.
  * @throws ezcCacheMemcacheException
  *         If the connection to the Memcache host did not succeed.
  *
  * @param array(string=>mixed) $options
  */
 public function __construct(array $options = array())
 {
     if (!ezcBaseFeatures::hasExtensionSupport('memcache')) {
         throw new ezcBaseExtensionNotFoundException('memcache', null, "PHP does not have Memcache support.");
     }
     if (!ezcBaseFeatures::hasExtensionSupport('zlib')) {
         throw new ezcBaseExtensionNotFoundException('zlib', null, "PHP not configured with --with-zlib.");
     }
     $this->options = new ezcCacheStorageMemcacheOptions($options);
     $this->connectionIdentifier = $this->options->host . ':' . $this->options->port;
     if (!isset(self::$connections[$this->connectionIdentifier])) {
         self::$connections[$this->connectionIdentifier] = new Memcache();
         // Currently 0 backends use the connection
         self::$connectionCounter[$this->connectionIdentifier] = 0;
     }
     $this->memcache = self::$connections[$this->connectionIdentifier];
     // Now 1 backend uses it
     self::$connectionCounter[$this->connectionIdentifier]++;
     if ($this->options->persistent === true) {
         if (!@$this->memcache->pconnect($this->options->host, $this->options->port, $this->options->ttl)) {
             throw new ezcCacheMemcacheException('Could not connect to Memcache using a persistent connection.');
         }
     } else {
         if (!@$this->memcache->connect($this->options->host, $this->options->port, $this->options->ttl)) {
             throw new ezcCacheMemcacheException('Could not connect to Memcache.');
         }
     }
     $this->memcache->setCompressThreshold(self::COMPRESS_THRESHOLD);
 }
 protected function setUp()
 {
     if (!ezcBaseFeatures::hasExtensionSupport('posix')) {
         $this->markTestSkipped('ext/posix is required for this test.');
     }
     $this->tempDir = $this->createTempDir('ezcConfigurationArrayWriterTest');
 }
 public function setUp()
 {
     if (!ezcBaseFeatures::hasExtensionSupport('haru')) {
         $this->markTestSkipped('This test requires pecl/haru installed.');
     }
     parent::setUp();
 }
Exemplo n.º 8
0
 public function setUp()
 {
     if (!ezcBaseFeatures::hasExtensionSupport('pdo_sqlite')) {
         $this->markTestSkipped();
         return;
     }
 }
Exemplo n.º 9
0
 /**
  * Get driver to test
  * 
  * @return ezcDocumentPdfDriver
  */
 protected function getDriver()
 {
     if (!ezcBaseFeatures::hasExtensionSupport('haru')) {
         $this->markTestSkipped('This test requires pecl/haru installed.');
     }
     return new ezcDocumentPdfHaruDriver();
 }
Exemplo n.º 10
0
 /**
  * Create a new image handler.
  * Creates an image handler. This should never be done directly,
  * but only through the manager for configuration reasons. One can
  * get a direct reference through manager afterwards.
  *
  * @param ezcImageHandlerSettings $settings
  *        Settings for the handler.
  *
  * @throws ezcImageHandlerNotAvailableException
  *         If the precondition for the handler is not fulfilled.
  */
 public function __construct(ezcImageHandlerSettings $settings)
 {
     if (!ezcBaseFeatures::hasExtensionSupport('gd')) {
         throw new ezcImageHandlerNotAvailableException("ezcImageGdHandler", "PHP extension 'GD' not available.");
     }
     $this->determineTypes();
     parent::__construct($settings);
 }
Exemplo n.º 11
0
 protected function setUp()
 {
     if (!ezcBaseFeatures::hasExtensionSupport('apc')) {
         $this->markTestSkipped("PHP must have APC support.");
     }
     // Class name == <inheriting class> - "Test"
     $storageClass = $this->storageClass = substr(get_class($this), 0, strlen(get_class($this)) - 4);
     $this->storage = new $storageClass($this->createTempDir('ezcCacheTest'), array('ttl' => 10));
 }
 public function setUp()
 {
     if (!ezcBaseFeatures::hasExtensionSupport('haru')) {
         $this->markTestSkipped('This test requires pecl/haru installed.');
     }
     parent::setUp();
     // Change error reporting - this is evil, but otherwise TCPDF will
     // abort the tests, because it throws lots of E_NOTICE and
     // E_DEPRECATED.
     $this->oldErrorReporting = error_reporting(E_PARSE | E_ERROR | E_WARNING);
 }
Exemplo n.º 13
0
 /**
  * (non-PHPdoc)
  * @see lib/ezc/MvcTools/src/ezcMvcRouter::createRoutes()
  */
 public function createRoutes()
 {
     if (empty($this->routes)) {
         // Check if route caching is enabled and if APC is available
         $isRouteCacheEnabled = eZINI::instance('rest.ini')->variable('CacheSettings', 'RouteApcCache') === 'enabled';
         if ($isRouteCacheEnabled && ezcBaseFeatures::hasExtensionSupport('apc')) {
             $this->routes = $this->getCachedRoutes();
         } else {
             $this->routes = $this->doCreateRoutes();
         }
     }
     return $this->routes;
 }
Exemplo n.º 14
0
 public function testRenderLongTextWithInternalLinks()
 {
     if (!ezcBaseFeatures::hasExtensionSupport('haru')) {
         $this->markTestSkipped('This test requires pecl/haru installed.');
     }
     $docbook = new ezcDocumentDocbook();
     $docbook->loadFile(dirname(__FILE__) . '/../files/pdf/internal_links.xml');
     $style = new ezcDocumentPcssStyleInferencer();
     $style->appendStyleDirectives(array(new ezcDocumentPcssLayoutDirective(array('page'), array('page-size' => 'A6'))));
     $renderer = new ezcDocumentPdfMainRenderer(new ezcDocumentPdfHaruDriver(), $style);
     $pdf = $renderer->render($docbook, new ezcDocumentPdfDefaultHyphenator());
     $this->assertPdfDocumentsSimilar($pdf, __CLASS__ . '_' . __FUNCTION__);
 }
Exemplo n.º 15
0
 protected function setUp()
 {
     if (!ezcBaseFeatures::hasExtensionSupport('ming')) {
         $this->markTestSkipped('This test needs ext/ming support.');
     }
     static $i = 0;
     $this->tempDir = $this->createTempDir(__CLASS__ . sprintf('_%03d_', ++$i)) . '/';
     $this->basePath = dirname(__FILE__) . '/data/';
     $this->driver = new ezcGraphFlashDriver();
     $this->driver->options->width = 200;
     $this->driver->options->height = 100;
     $this->driver->options->font->path = $this->basePath . 'fdb_font.fdb';
 }
Exemplo n.º 16
0
 protected function setUp()
 {
     if (!ezcBaseFeatures::hasExtensionSupport('cairo')) {
         $this->markTestSkipped('This test needs pecl/cairo support.');
     }
     static $i = 0;
     $this->tempDir = $this->createTempDir('ezcGraphCairoDriverTest' . sprintf('_%03d_', ++$i)) . '/';
     $this->basePath = dirname(__FILE__) . '/data/';
     $this->driver = new ezcGraphCairoOODriver();
     $this->driver->options->width = 200;
     $this->driver->options->height = 100;
     $this->driver->options->font->path = $this->basePath . 'font.ttf';
 }
Exemplo n.º 17
0
 protected function setUp()
 {
     if (!ezcBaseFeatures::hasExtensionSupport('gd') && (ezcBaseFeatures::hasFunction('imagefttext') || ezcBaseFeatures::hasFunction('imagettftext'))) {
         $this->markTestSkipped('This test needs ext/gd with native ttf support or FreeType 2 support.');
     }
     static $i = 0;
     $this->tempDir = $this->createTempDir(__CLASS__ . sprintf('_%03d_', ++$i)) . '/';
     $this->basePath = dirname(__FILE__) . '/data/';
     $this->driver = new ezcGraphGdDriver();
     $this->driver->options->width = 200;
     $this->driver->options->height = 100;
     $this->driver->options->font->path = $this->basePath . 'font.ttf';
     $this->driver->options->supersampling = 1;
 }
Exemplo n.º 18
0
 protected function setUp()
 {
     if (!ezcBaseFeatures::hasExtensionSupport('memcache')) {
         $this->markTestSkipped('PHP must have Memcache support.');
     }
     if (!ezcBaseFeatures::hasExtensionSupport('zlib')) {
         $this->markTestSkipped('PHP must be compiled with --with-zlib.');
     }
     $testMemcache = new Memcache();
     if (@$testMemcache->connect('localhost', 11211) === false) {
         $this->markTestSkipped('No Memcache server running on port 11211 found.');
     }
     $testMemcache->close();
     $this->memcacheBackend = new ezcCacheMemcacheBackend();
 }
Exemplo n.º 19
0
 public function setUp()
 {
     if (!ezcBaseFeatures::hasExtensionSupport('ldap')) {
         $this->markTestSkipped("PHP must be compiled with --with-ldap.");
     }
     try {
         $credentials = new ezcAuthenticationPasswordCredentials('zhang.san', 'asdfgh');
         $ldap = new ezcAuthenticationLdapInfo(self::$host, self::$format, self::$base, self::$port);
         $authentication = new ezcAuthentication($credentials);
         $authentication->addFilter(new ezcAuthenticationLdapFilter($ldap));
         $authentication->run();
     } catch (ezcAuthenticationLdapException $e) {
         // this will be changed later when we will have a test server with LDAP
         $this->markTestSkipped("Cannot connect to LDAP. Probably you didn't setup the LDAP enviroment: " . $e->getMessage());
     }
 }
Exemplo n.º 20
0
 public function testCreateBzip2TarWithTwoFiles()
 {
     if (!ezcBaseFeatures::hasExtensionSupport('bz2')) {
         $this->markTestSkipped();
     }
     $dir = $this->getTempDir();
     $archive = ezcArchive::open("compress.bzip2://{$dir}/mytar.tar.bz2", ezcArchive::TAR_USTAR);
     file_put_contents("{$dir}/a.txt", "Hello world!");
     file_put_contents("{$dir}/b.txt", "BBBBBBBBBBBB");
     $archive->append("{$dir}/a.txt", $dir);
     $archive->append("{$dir}/b.txt", $dir);
     $archive->close();
     exec("tar -cf {$dir}/gnutar.tar --format=ustar -C {$dir} a.txt b.txt");
     exec("bunzip2 {$dir}/mytar.tar.bz2");
     $this->assertEquals(file_get_contents("{$dir}/gnutar.tar"), file_get_contents("{$dir}/mytar.tar"));
 }
 protected function setUp()
 {
     if (!ezcBaseFeatures::hasExtensionSupport('memcache')) {
         $this->markTestSkipped('PHP must have Memcache support.');
     }
     if (!ezcBaseFeatures::hasExtensionSupport('zlib')) {
         $this->markTestSkipped('PHP must be compiled with --with-zlib.');
     }
     $testMemcache = new Memcache();
     if (@$testMemcache->connect('localhost', 11211) === false) {
         $this->markTestSkipped('No Memcache server running on port 11211 found.');
     }
     // Class name == <inheriting class> - "Test"
     $storageClass = $this->storageClass = substr(get_class($this), 0, strlen(get_class($this)) - 4);
     $this->storage = new $storageClass($this->createTempDir('ezcCacheTest'), array('host' => 'localhost', 'port' => 11211, 'ttl' => 10));
     $this->testData = array(1 => "Test 1 2 3 4 5 6 7 8\\\\", 2 => 'La la la 02064 lololo', 3 => 12345, 4 => 12.3746);
 }
Exemplo n.º 22
0
 /**
  * Ensure the test environment is properly set up for the currently
  * selected driver.
  */
 protected function checkTestEnv(ezcDocumentPdfDriver $driver)
 {
     switch (true) {
         case $driver instanceof ezcDocumentPdfSvgDriver:
             $this->extension = 'svg';
             break;
         case $driver instanceof ezcDocumentPdfHaruDriver:
             if (!ezcBaseFeatures::hasExtensionSupport('haru')) {
                 $this->markTestSkipped('This test requires pecl/haru installed.');
             }
             break;
         case $driver instanceof ezcDocumentPdfTcpdfDriver:
             if (!class_exists('TCPDF')) {
                 $this->markTestSkipped('This test requires the TCPDF class.');
             }
             // Change error reporting - this is evil, but otherwise TCPDF will
             // abort the tests, because it throws lots of E_NOTICE and
             // E_DEPRECATED.
             $this->oldErrorReporting = error_reporting(E_PARSE | E_ERROR | E_WARNING);
             break;
     }
 }
 /**
  * @dataProvider getTestDocuments
  */
 public function testLoadXmlDocumentFromFile($from, $to)
 {
     if (!ezcBaseFeatures::hasExtensionSupport('xsl')) {
         $this->markTestSkipped('You need XSLT support for this test.');
     }
     if (!is_file($to)) {
         $this->markTestSkipped("Comparision file '{$to}' not yet defined.");
     }
     $doc = new ezcDocumentDocbook();
     $doc->loadFile($from);
     $converter = new ezcDocumentDocbookToHtmlXsltConverter();
     $created = $converter->convert($doc);
     $this->assertTrue($created instanceof ezcDocumentXhtml);
     // Replace creator string in generated document, as this may change too
     // often for proper testing.
     $dom = $created->getDomDocument();
     $domContent = $dom->saveXml();
     // Just test that some kind of HTML has been created - everything is up
     // to the used XSL and may change any time.
     $this->assertTrue(strpos($domContent, '<html') !== false);
     // Remove tempdir, when nothing failed.
     $this->removeTempDir();
 }
Exemplo n.º 24
0
 /**
  * Constructs a new connection to the $server using the port $port.
  *
  * {@link ezcMailTransportOptions} for options you can specify for a
  * transport connection.
  *
  * @todo The @ should be removed when PHP doesn't throw warnings for connect problems.
  *
  * @throws ezcMailTransportException
  *         if a connection to the server could not be made
  * @throws ezcBaseExtensionNotFoundException
  *         if trying to use SSL and the extension openssl is not installed
  * @throws ezcBasePropertyNotFoundException
  *         if $options contains a property not defined
  * @throws ezcBaseValueException
  *         if $options contains a property with a value not allowed
  * @param string $server
  * @param int $port
  * @param ezcMailTransportOptions $options
  */
 public function __construct($server, $port, ezcMailTransportOptions $options = null)
 {
     $errno = null;
     $errstr = null;
     if ($options === null) {
         $this->options = new ezcMailTransportOptions();
     } else {
         $this->options = $options;
     }
     if ($this->options->ssl) {
         if (ezcBaseFeatures::hasExtensionSupport('openssl') !== true) {
             throw new ezcBaseExtensionNotFoundException('openssl', null, "PHP not configured --with-openssl.");
         }
         $this->connection = @stream_socket_client("ssl://{$server}:{$port}", $errno, $errstr, $this->options->timeout);
     } else {
         $this->connection = @stream_socket_client("tcp://{$server}:{$port}", $errno, $errstr, $this->options->timeout);
     }
     if (is_resource($this->connection)) {
         stream_set_timeout($this->connection, $this->options->timeout);
     } else {
         throw new ezcMailTransportException("Failed to connect to the server: {$server}:{$port}.");
     }
 }
Exemplo n.º 25
0
 /**
  * Constructs a new attachment with $fileName.
  *
  * If the $mimeType and $contentType are not specified they are extracted
  * with the fileinfo extension if it is available, otherwise they are set
  * to application/octet-stream.
  *
  * @param string $fileName
  * @param string $contentType
  * @param string $mimeType
  */
 public function __construct($fileName, $contentType = null, $mimeType = null)
 {
     parent::__construct($fileName);
     if ($contentType != null && $mimeType != null) {
         $this->contentType = $contentType;
         $this->mimeType = $mimeType;
     } elseif (ezcBaseFeatures::hasExtensionSupport('fileinfo')) {
         // get mime and content type
         $fileInfo = finfo_open(FILEINFO_MIME);
         $mimeParts = finfo_file($fileInfo, $fileName);
         if ($mimeParts !== false && strpos($mimeParts, '/') !== false) {
             list($this->contentType, $this->mimeType) = explode('/', $mimeParts);
         } else {
             // default to mimetype application/octet-stream
             $this->contentType = self::CONTENT_TYPE_APPLICATION;
             $this->mimeType = "octet-stream";
         }
         finfo_close($fileInfo);
     } else {
         // default to mimetype application/octet-stream
         $this->contentType = self::CONTENT_TYPE_APPLICATION;
         $this->mimeType = "octet-stream";
     }
 }
Exemplo n.º 26
0
 /**
  * Returns the mime type of a resource.
  *
  * Return the mime type of the resource identified by $path. If a mime type
  * extension is available it will be used to read the real mime type,
  * otherwise the original mime type passed by the client when uploading the
  * file will be returned. If no mimetype has ever been associated with the
  * file, the method will just return 'application/octet-stream'.
  * 
  * @param string $path 
  * @return string
  */
 protected function getMimeType($path)
 {
     // Check if extension pecl/fileinfo is usable.
     if ($this->options->useMimeExts && ezcBaseFeatures::hasExtensionSupport('fileinfo')) {
         $fInfo = new fInfo(FILEINFO_MIME);
         $mimeType = $fInfo->file($this->root . $path);
         // The documentation tells to do this, but it does not work with a
         // current version of pecl/fileinfo
         // $fInfo->close();
         return $mimeType;
     }
     // Check if extension ext/mime-magic is usable.
     if ($this->options->useMimeExts && ezcBaseFeatures::hasExtensionSupport('mime_magic') && ($mimeType = mime_content_type($this->root . $path)) !== false) {
         return $mimeType;
     }
     // Check if some browser submitted mime type is available.
     $storage = $this->getPropertyStorage($path);
     $properties = $storage->getAllProperties();
     if (isset($properties['DAV:']['getcontenttype'])) {
         return $properties['DAV:']['getcontenttype']->mime;
     }
     // Default to 'application/octet-stream' if nothing else is available.
     return 'application/octet-stream';
 }
Exemplo n.º 27
0
 public function testTypeKeyFetchExtraDataWithEmail()
 {
     if (!ezcBaseFeatures::hasExtensionSupport('gmp')) {
         $this->markTestSkipped('PHP must be compiled with --with-gmp.');
     }
     $_GET = self::$responseWithEmail;
     $credentials = new ezcAuthenticationIdCredentials(self::$token);
     $authentication = new ezcAuthentication($credentials);
     $filter = new ezcAuthenticationTypekeyFilter();
     $filter->lib = ezcAuthenticationMath::createBignumLibrary('gmp');
     $authentication->addFilter($filter);
     $this->assertEquals(true, $authentication->run());
     $expected = array('name' => array('ezc'), 'nick' => array('ezctest'), 'email' => array('*****@*****.**'));
     $this->assertEquals($expected, $filter->fetchData());
 }
Exemplo n.º 28
0
 public function testRenderLabeledPieSegmentWithGleamAndShadowGD()
 {
     if (!ezcBaseFeatures::hasExtensionSupport('gd') && (ezcBaseFeatures::hasFunction('imagefttext') || ezcBaseFeatures::hasFunction('imagettftext'))) {
         $this->markTestSkipped('This test needs ext/gd with native ttf support or FreeType 2 support.');
     }
     $filename = $this->tempDir . __FUNCTION__ . '.png';
     $chart = new ezcGraphPieChart();
     $chart->data['sample'] = new ezcGraphArrayDataSet(array('Mozilla' => 4375, 'IE' => 345, 'Opera' => 1204, 'wget' => 231, 'Safari' => 987));
     $chart->options->font->path = dirname(__FILE__) . '/data/font.ttf';
     $chart->data['sample']->highlight['Safari'] = true;
     $chart->data['sample']->color['Safari'] = '#000000';
     $chart->data['sample']->highlight['IE'] = true;
     $chart->data['sample']->symbol['IE'] = ezcGraph::CIRCLE;
     $chart->data['sample']->symbol['Opera'] = ezcGraph::BULLET;
     $chart->data['sample']->symbol['wget'] = ezcGraph::DIAMOND;
     $chart->renderer = new ezcGraphRenderer3d();
     $chart->renderer->options->pieChartShadowSize = 10;
     $chart->renderer->options->pieChartGleam = 0.5;
     $chart->renderer->options->dataBorder = false;
     $chart->renderer->options->pieChartHeight = 16;
     $chart->renderer->options->legendSymbolGleam = 0.5;
     $chart->renderer->options->pieChartOffset = 180;
     $chart->driver = new ezcGraphGdDriver();
     $chart->render(500, 200, $filename);
     $this->assertImageSimilar($filename, $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png', 'Image does not look as expected.', 2000);
 }
Exemplo n.º 29
0
 /**
  * Detects if a PHP accelerator is running and what type it is.
  *
  * @return ezcSystemInfoAccelerator or null if no PHP accelerator detected
  */
 public static function phpAccelerator()
 {
     $phpAcceleratorInfo = null;
     if (ezcBaseFeatures::hasExtensionSupport("Turck MMCache")) {
         $phpAcceleratorInfo = new ezcSystemInfoAccelerator("Turck MMCache", "http://turck-mmcache.sourceforge.net", true, false, false);
     }
     if (ezcBaseFeatures::hasExtensionSupport("eAccelerator")) {
         $phpAcceleratorInfo = new ezcSystemInfoAccelerator("eAccelerator", "http://sourceforge.net/projects/eaccelerator/", true, false, phpversion('eAccelerator'));
     }
     if (ezcBaseFeatures::hasExtensionSupport("apc")) {
         $phpAcceleratorInfo = new ezcSystemInfoAccelerator("APC", "http://pecl.php.net/package/APC", ini_get('apc.enabled') != 0, false, phpversion('apc'));
     }
     if (ezcBaseFeatures::hasExtensionSupport("Zend Performance Suite")) {
         $phpAcceleratorInfo = new ezcSystemInfoAccelerator("Zend Performance Suite", "http://www.zend.com/en/products/platform/", true, false, false);
     }
     if (ezcBaseFeatures::hasExtensionSupport('XCache')) {
         $phpAcceleratorInfo = new ezcSystemInfoAccelerator("XCache", "http://xcache.lighttpd.net/", true, false, phpversion('XCache'));
     }
     return $phpAcceleratorInfo;
 }
Exemplo n.º 30
0
 /**
  * Constructs a new ezcCacheApcBackend object.
  *
  * @throws ezcBaseExtensionNotFoundException
  *         If the PHP apc extension is not installed.
  */
 public function __construct()
 {
     if (!ezcBaseFeatures::hasExtensionSupport('apc')) {
         throw new ezcBaseExtensionNotFoundException('apc', null, "PHP does not have APC support.");
     }
 }