This repository was archived by the owner on Nov 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathStubsCase.php
More file actions
57 lines (46 loc) · 1.3 KB
/
StubsCase.php
File metadata and controls
57 lines (46 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
class StubsCase extends PHPUnit_Framework_TestCase
{
public $fixtures;
public $stubs;
public $destination;
protected function setUp()
{
$this->setFixtures(__DIR__.'/fixtures');
$this->setStubs(dirname(__DIR__).'/src/CLI/Scaffolding/Presets/stubs');
$this->setDestination("{$this->fixtures}/scaffolding");
$this->temp = "{$this->fixtures}/.temp";
$dir = escapeshellarg($this->destination);
$temp = escapeshellarg($this->temp);
exec("cp -R $dir $temp");
}
protected function tearDown()
{
$dir = escapeshellarg($this->destination);
$temp = escapeshellarg($this->temp);
exec("rm -rf $dir");
exec("mv $temp $dir");
}
public function assertFileContains($expected, $input)
{
$this->assertContains($expected, file_get_contents($input));
}
public function setFixtures($fixtures)
{
if (! isset($this->fixtures)) {
$this->fixtures = $fixtures;
}
}
public function setStubs($stubs)
{
if (! isset($this->stubs)) {
$this->stubs = $stubs;
}
}
public function setDestination($destination)
{
if (! isset($this->destination)) {
$this->destination = $destination;
}
}
}