| 107 | /** |
| 108 | * Two WordPress installs, with a duplicated token in the path. |
| 109 | * |
| 110 | * FTP / = /var/www/example.com/ on disk |
| 111 | * example.com at /example.com/ (/var/www/example.com/example.com on disk) |
| 112 | * sub.example.com at /sub.example.com/ (/var/www/example.com/sub.example.com/ on disk) |
| 113 | * |
| 114 | * @ticket 20652 |
| 115 | */ |
| 116 | function test_two_tokens_in_path2() { |
| 117 | global $wp_filesystem; |
| 118 | $fs = $wp_filesystem; |
| 119 | $fs->init(' |
| 120 | /example.com/index.php |
| 121 | /example.com/wp-includes/ |
| 122 | /example.com/wp-content/plugins/ |
| 123 | |
| 124 | /sub.example.com/index.php |
| 125 | /sub.example.com/wp-includes/ |
| 126 | /sub.example.com/wp-content/plugins/ |
| 127 | '); |
| 128 | |
| 129 | // example.com |
| 130 | $path = $fs->abspath( '/var/www/example.com/example.com/' ); |
| 131 | $this->assertEquals( '/example.com/', $path ); |
| 132 | |
| 133 | // sub.example.com |
| 134 | $path = $fs->abspath( '/var/www/example.com/sub.example.com/' ); |
| 135 | $this->assertEquals( '/sub.example.com/', $path ); |
| 136 | |
| 137 | // sub.example.com - Plugins |
| 138 | $path = $fs->find_folder( '/var/www/example.com/sub.example.com/wp-content/plugins/' ); |
| 139 | $this->assertEquals( '/sub.example.com/wp-content/plugins/', $path ); |
| 140 | } |
| 141 | |
| 142 | |