Completed
Push — master ( b81ba8...e2cfeb )
by Daryl
02:02 queued 35s
created

RoboFile.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * This is project's console commands configuration for Robo task runner.
4
 *
5
 * @see http://robo.li/
6
 */
7
class RoboFile extends \Robo\Tasks
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
8
{
9
    // define public methods as commands
10
	function tests()
11
	{
12
13
		$this->taskExec('mysql -e "CREATE DATABASE IF NOT EXISTS test_db"')->run();
14
		$this->taskExec('mysql -e "GRANT ALL ON test_db.* to \'root\'@\'%\'"')->run();
15
		$this->taskSvnStack()
16
			->checkout('https://develop.svn.wordpress.org/tags/4.8.3 wp-tests')
17
			->run();
18
19
		$this->setTestConfig();
20
		$this->phpunit();
21
22
	}
23
24
	function phpunit()
25
	{
26
		$this->taskPhpUnit('vendor/bin/phpunit')
27
		     ->configFile('tests/phpunit.xml.dist')
28
		     ->run();
29
	}
30
31
	private function setTestConfig()
32
	{
33
34
		if (file_exists('wp-tests/wp-tests-config-sample.php')) {
35
			copy('wp-tests/wp-tests-config-sample.php', 'wp-tests/wp-tests-config.php');
36
		}
37
38
		$this->taskReplaceInFile( 'wp-tests/wp-tests-config.php')
39
			->from('youremptytestdbnamehere')
40
			->to('test_db')
41
			->run();
42
43
		$this->taskReplaceInFile( 'wp-tests/wp-tests-config.php')
44
			->from('yourusernamehere')
45
			->to('root')
46
			->run();
47
48
		$this->taskReplaceInFile( 'wp-tests/wp-tests-config.php')
49
			->from('yourpasswordhere')
50
			->to('')
51
			->run();
52
	}
53
54
}