Hoa central
Public Member Functions | List of all members
Hoa\Iterator\Test\Unit\SplFileInfo Class Reference
Inheritance diagram for Hoa\Iterator\Test\Unit\SplFileInfo:

Public Member Functions

 case_file ()
 
 case_directory ()
 
 case_path_informations ()
 
 case_times ()
 
 case_permissions ()
 
- Public Member Functions inherited from Hoa\Test\Unit\Suite
 __construct ()
 
 getTestedClassName ()
 
 getTestedClassNamespace ()
 
 beforeTestMethod ($methodName)
 

Detailed Description

Class .

Test suite of the SplFileInfo class.

Definition at line 50 of file SplFileInfo.php.

Member Function Documentation

Hoa\Iterator\Test\Unit\SplFileInfo::case_directory ( )

Definition at line 64 of file SplFileInfo.php.

65  {
66  $this
67  ->given($pathname = 'hoa://Test/Vfs/Foo?type=directory')
68  ->when($result = new LUT\SplFileInfo($pathname))
69  ->then
70  ->boolean($result->isDir())
71  ->isTrue()
72  ->string($result->getType())
73  ->isEqualTo('dir');
74  }
Hoa\Iterator\Test\Unit\SplFileInfo::case_file ( )

Definition at line 52 of file SplFileInfo.php.

53  {
54  $this
55  ->given($pathname = 'hoa://Test/Vfs/Foo.bar')
56  ->when($result = new LUT\SplFileInfo($pathname))
57  ->then
58  ->boolean($result->isFile())
59  ->isTrue()
60  ->string($result->getType())
61  ->isEqualTo('file');
62  }
Hoa\Iterator\Test\Unit\SplFileInfo::case_path_informations ( )

Definition at line 76 of file SplFileInfo.php.

77  {
78  $this
79  ->given(
80  $relativePath = 'hoa://Test/Vfs/A/B/',
81  $relativePathname = 'C/Foo.bar',
82  $pathname = $relativePath . $relativePathname
83  )
84  ->when($result = new LUT\SplFileInfo($pathname, $relativePath))
85  ->then
86  ->boolean($result->isFile())
87  ->isTrue()
88  ->string($result->getBasename())
89  ->isEqualTo('Foo.bar')
90  ->string($result->getExtension())
91  ->isEqualTo('bar')
92  ->string($result->getRelativePath())
93  ->isEqualTo($relativePath)
94  ->string($result->getRelativePathname())
95  ->isEqualTo($relativePathname)
96  ->string($result->getPath())
97  ->isEqualTo('hoa://Test/Vfs/A/B/C')
98  ->string($result->getPathname())
99  ->isEqualTo($pathname);
100  }
Hoa\Iterator\Test\Unit\SplFileInfo::case_permissions ( )

Definition at line 130 of file SplFileInfo.php.

131  {
132  $this
133  ->given($pathname = 'hoa://Test/Vfs/Fo.bar?permissions=0744')
134  ->when($result = new LUT\SplFileInfo($pathname))
135  ->then
136  ->boolean($result->isReadable())
137  ->isTrue()
138  ->boolean($result->isWritable())
139  ->isTrue()
140  ->boolean($result->isExecutable())
141  ->isTrue()
142 
143  ->given($pathname = 'hoa://Test/Vfs/Foo.bar?permissions=0644')
144  ->when($result = new LUT\SplFileInfo($pathname))
145  ->then
146  ->boolean($result->isReadable())
147  ->isTrue()
148  ->boolean($result->isWritable())
149  ->isTrue()
150  ->boolean($result->isExecutable())
151  ->isFalse()
152 
153  ->given($pathname = 'hoa://Test/Vfs/Fooo.bar?permissions=0444')
154  ->when($result = new LUT\SplFileInfo($pathname))
155  ->then
156  ->boolean($result->isReadable())
157  ->isTrue()
158  ->boolean($result->isWritable())
159  ->isFalse()
160  ->boolean($result->isExecutable())
161  ->isFalse()
162 
163  ->given($pathname = 'hoa://Test/Vfs/Foooo.bar?permissions=0044')
164  ->when($result = new LUT\SplFileInfo($pathname))
165  ->then
166  ->boolean($result->isReadable())
167  ->isFalse()
168  ->boolean($result->isWritable())
169  ->isFalse()
170  ->boolean($result->isExecutable())
171  ->isFalse();
172  }
Hoa\Iterator\Test\Unit\SplFileInfo::case_times ( )

Definition at line 102 of file SplFileInfo.php.

103  {
104  $this
105  ->given(
106  $timestamp = $this->realdom->boundinteger(
107  $this->realdom->timestamp('yesterday'),
108  $this->realdom->timestamp('tomorrow')
109  ),
110  $atime = $this->sample($timestamp),
111  $ctime = $this->sample($timestamp),
112  $mtime = $this->sample($timestamp),
113  $pathname = 'hoa://Test/Vfs/Foo.bar?' .
114  http_build_query([
115  'atime' => $atime,
116  'ctime' => $ctime,
117  'mtime' => $mtime
118  ])
119  )
120  ->when($result = new LUT\SplFileInfo($pathname))
121  ->then
122  ->integer($result->getATime())
123  ->isEqualTo($atime)
124  ->integer($result->getCTime())
125  ->isEqualTo($ctime)
126  ->integer($result->getMTime())
127  ->isEqualTo($mtime);
128  }

The documentation for this class was generated from the following file: