Overview

Packages

  • Jyxo_Beholder
  • Jyxo_Charset
  • Jyxo_Color
  • Jyxo_Css
  • Jyxo_ErrorHandling
  • Jyxo_FirePhp
  • Jyxo_Gettext
    • Parser
  • Jyxo_Html
  • Jyxo_Input
    • Chain
    • Filter
    • Validator
  • Jyxo_Mail
    • Email
    • Parser
    • Sender
  • Jyxo_Rpc
    • Json
    • Xml
  • Jyxo_Shell
  • Jyxo_SpamFilter
  • Jyxo_Spl
  • Jyxo_String
  • Jyxo_Svn
  • Jyxo_Time
  • Jyxo_Timer
  • Jyxo_Webdav
  • Jyxo_XmlReader
  • PHP

Classes

  • Jyxo_Beholder_Executor
  • Jyxo_Beholder_Result
  • Jyxo_Beholder_TestCase
  • Jyxo_Beholder_TestCase_FileSystem
  • Jyxo_Beholder_TestCase_HttpResponse
  • Jyxo_Beholder_TestCase_Imap
  • Jyxo_Beholder_TestCase_JsonRpc
  • Jyxo_Beholder_TestCase_Memcached
  • Jyxo_Beholder_TestCase_Mysql
  • Jyxo_Beholder_TestCase_Pgsql
  • Jyxo_Beholder_TestCase_PhpExtension
  • Jyxo_Beholder_TestCase_PhpVersion
  • Jyxo_Beholder_TestCase_PhpZend
  • Jyxo_Beholder_TestCase_Smtp
  • Jyxo_Beholder_TestCase_Webdav
  • Jyxo_Beholder_TestCase_XmlRpc
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
 1: <?php
 2: 
 3: /**
 4:  * Jyxo PHP Library
 5:  *
 6:  * LICENSE
 7:  *
 8:  * This source file is subject to the new BSD license that is bundled
 9:  * with this package in the file license.txt.
10:  * It is also available through the world-wide-web at this URL:
11:  * https://github.com/jyxo/php/blob/master/license.txt
12:  */
13: 
14: /**
15:  * Filesystem access test.
16:  *
17:  * @category Jyxo
18:  * @package Jyxo_Beholder
19:  * @copyright Copyright (c) 2005-2011 Jyxo, s.r.o.
20:  * @license https://github.com/jyxo/php/blob/master/license.txt
21:  * @author Jaroslav HanslĂ­k
22:  */
23: class Jyxo_Beholder_TestCase_FileSystem extends Jyxo_Beholder_TestCase
24: {
25:     /**
26:      * Tested directory.
27:      *
28:      * @var string
29:      */
30:     private $dir;
31: 
32:     /**
33:      * Constructor.
34:      *
35:      * @param string $description Test description
36:      * @param string $dir Tested directory
37:      */
38:     public function __construct($description, $dir)
39:     {
40:         parent::__construct($description);
41: 
42:         $this->dir = (string) $dir;
43:     }
44: 
45:     /**
46:      * Performs the test.
47:      *
48:      * @return Jyxo_Beholder_Result
49:      */
50:     public function run()
51:     {
52:         $random = md5(uniqid(time(), true));
53:         $path = $this->dir . '/beholder-' . $random . '.txt';
54:         $content = $random;
55: 
56:         // Writing
57:         if (!file_put_contents($path, $content)) {
58:             return new Jyxo_Beholder_Result(Jyxo_Beholder_Result::FAILURE, sprintf('Write error %s', $this->dir));
59:         }
60: 
61:         // Reading
62:         $readContent = file_get_contents($path);
63:         if (strlen($readContent) !== strlen($content)) {
64:             return new Jyxo_Beholder_Result(Jyxo_Beholder_Result::FAILURE, sprintf('Read error %s', $this->dir));
65:         }
66: 
67:         // Deleting
68:         if (!@unlink($path)) {
69:             return new Jyxo_Beholder_Result(Jyxo_Beholder_Result::FAILURE, sprintf('Delete error %s', $this->dir));
70:         }
71: 
72:         // OK
73:         return new Jyxo_Beholder_Result(Jyxo_Beholder_Result::SUCCESS, $this->dir);
74:     }
75: }
76: 
Jyxo PHP Library API documentation generated by ApiGen 2.3.0