aboutsummaryrefslogtreecommitdiffstats
path: root/tests/controller/controller_test.php
blob: cd90dda751afcbd583c81efe055b1d046ea8eb28 (plain)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/

require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;

class phpbb_controller_controller_test extends phpbb_test_case
{
	public function setUp()
	{
		$this->extension_manager = new phpbb_mock_extension_manager(
			dirname(__FILE__) . '/',
			array(
				'vendor2/foo' => array(
					'ext_name' => 'vendor2/foo',
					'ext_active' => '1',
					'ext_path' => 'ext/vendor2/foo/',
				),
			));
	}

	public function test_router_find_files()
	{
		$router = new \phpbb\routing\router($this->extension_manager, dirname(__FILE__) . '/', 'php');
		$router->find_routing_files($this->extension_manager->get_finder());
		$routes = $router->find(__DIR__)->get_routes();

		// This will need to be updated if any new routes are defined
		$this->assertInstanceOf('Symfony\Component\Routing\Route', $routes->get('core_controller'));
		$this->assertEquals('/core_foo', $routes->get('core_controller')->getPath());

		$this->a
  for (int i = 3; i < argc; i++) {
    Header header;
    FD_t fd = strcmp(argv[i], "-") == 0 ? fdDup(STDIN_FILENO) : fdOpen(argv[i], O_RDONLY, 0);
    if (fdFileno(fd) < 0) {
      fprintf(stderr, "%s: cannot open file %s\n", argv[0], argv[i]);
      exit(1);
    }

    while ((header=headerRead(fd, HEADER_MAGIC_YES))) {
      int_32 type, count;
      unsigned short *p;
      char **f, *name;
      int printed = 0;

      headerGetEntry(header, RPMTAG_NAME, &type, (void **) &name, NULL);
      headerGetEntry(header, RPMTAG_FILEMODES, &type, (void **) &p, &count);
      headerGetEntry(header, RPMTAG_OLDFILENAMES, &type, (void **) &f, NULL);

      char ** baseNames, ** dirNames;
      int_32 * dirIndexes;
      headerGetEntry(header, RPMTAG_BASENAMES, &type, (void **) &baseNames, NULL);
      headerGetEntry(header, RPMTAG_DIRINDEXES, &type, (void **) &dirIndexes, NULL);
      headerGetEntry(header, RPMTAG_DIRNAMES, &type, (void **) &dirNames, NULL);

      for (int i = 0; i < count; i++) {
	if ((p[i] & 040111) == 0111) {
	  int ok;
	  if (f) {
	    char *s = strrchr(f[i], '/');
	    ok = s && s - 3 >= f[i] && strncmp(s - 3, "bin", 3) == 0 &&
	      (!allow || allow->count(s + 1)) &&
	      (!deny || !deny->count(s + 1));
	  } else {
	    char *d =
pan> && strncmp(d + strlen(d) - 4, "bin/", 4) == 0 && (!allow || allow->count(baseNames[i])) && (!deny || !deny->count(baseNames[i])); } if (ok) { if (!printed) { printed = 1; cout << name; } if (f) cout << " " << f[i]; else cout << " " << dirNames[dirIndexes[i]] << baseNames[i]; } } } if (printed) cout << "\n"; } fdClose(fd); } return 0; }