| 148 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/*
|
|
|
4 |
Copyright (c) 2009 hamcrest.org
|
|
|
5 |
*/
|
|
|
6 |
require __DIR__ . '/../vendor/autoload.php';
|
|
|
7 |
|
|
|
8 |
/*
|
|
|
9 |
* Generates the Hamcrest\Matchers factory class and factory functions
|
|
|
10 |
* from the @factory doctags in the various matchers.
|
|
|
11 |
*/
|
|
|
12 |
|
|
|
13 |
define('GENERATOR_BASE', __DIR__);
|
|
|
14 |
define('HAMCREST_BASE', realpath(dirname(GENERATOR_BASE) . DIRECTORY_SEPARATOR . 'hamcrest'));
|
|
|
15 |
|
|
|
16 |
define('GLOBAL_FUNCTIONS_FILE', HAMCREST_BASE . DIRECTORY_SEPARATOR . 'Hamcrest.php');
|
|
|
17 |
define('STATIC_MATCHERS_FILE', HAMCREST_BASE . DIRECTORY_SEPARATOR . 'Hamcrest' . DIRECTORY_SEPARATOR . 'Matchers.php');
|
|
|
18 |
|
|
|
19 |
set_include_path(
|
|
|
20 |
implode(
|
|
|
21 |
PATH_SEPARATOR,
|
|
|
22 |
array(
|
|
|
23 |
GENERATOR_BASE,
|
|
|
24 |
HAMCREST_BASE,
|
|
|
25 |
get_include_path()
|
|
|
26 |
)
|
|
|
27 |
)
|
|
|
28 |
);
|
|
|
29 |
|
|
|
30 |
@unlink(GLOBAL_FUNCTIONS_FILE);
|
|
|
31 |
@unlink(STATIC_MATCHERS_FILE);
|
|
|
32 |
|
|
|
33 |
$generator = new FactoryGenerator(HAMCREST_BASE . DIRECTORY_SEPARATOR . 'Hamcrest');
|
|
|
34 |
$generator->addFactoryFile(new StaticMethodFile(STATIC_MATCHERS_FILE));
|
|
|
35 |
$generator->addFactoryFile(new GlobalFunctionFile(GLOBAL_FUNCTIONS_FILE));
|
|
|
36 |
$generator->generate();
|
|
|
37 |
$generator->write();
|