| @@ 50-63 (lines=14) @@ | ||
| 47 | * @expectedException Naneau\FileGen\File\Contents\Exception |
|
| 48 | * @return void |
|
| 49 | **/ |
|
| 50 | public function testNotExists() |
|
| 51 | { |
|
| 52 | $generator = $this->createGenerator(); |
|
| 53 | ||
| 54 | $structure = new Structure; |
|
| 55 | $structure |
|
| 56 | ->file('foo', 'foo contents') |
|
| 57 | ->file( |
|
| 58 | 'bar', |
|
| 59 | new CopyContents($generator->getRoot() . '/I-do-not-exist') |
|
| 60 | ); |
|
| 61 | ||
| 62 | $generator->generate($structure); |
|
| 63 | } |
|
| 64 | ||
| 65 | /** |
|
| 66 | * Test copy fail |
|
| @@ 61-72 (lines=12) @@ | ||
| 58 | * |
|
| 59 | * @return void |
|
| 60 | **/ |
|
| 61 | public function testAlreadyExists() |
|
| 62 | { |
|
| 63 | $structure = new Structure; |
|
| 64 | $structure->file('foo', 'foo'); |
|
| 65 | ||
| 66 | $generator = $this->createGenerator(); |
|
| 67 | ||
| 68 | // dir exists already... oh noes. |
|
| 69 | file_put_contents($generator->getRoot() . '/foo', 'foo'); |
|
| 70 | ||
| 71 | $generator->generate($structure); |
|
| 72 | } |
|
| 73 | } |
|
| 74 | ||