-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
208 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ out | |
node_modules | ||
npm-debug.log | ||
*.vsix | ||
.vscode-test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
.vscode/** | ||
.vscode-test/** | ||
src/** | ||
out/test/** | ||
test/** | ||
testProject/** | ||
**/*.map | ||
.gitignore | ||
.travis.yml | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import * as assert from 'assert'; | ||
import * as path from 'path'; | ||
import { execSync } from 'child_process'; | ||
import { | ||
workspace as Workspace, | ||
window as Window, | ||
commands as Commands | ||
} from 'vscode'; | ||
|
||
function hasFormat(file: string): Thenable<void> { | ||
const absPath: string = path.join(Workspace.rootPath!, file); | ||
|
||
return Workspace.openTextDocument(absPath).then(doc => { | ||
return Window.showTextDocument(doc).then(() => | ||
Commands.executeCommand('editor.action.formatDocument').then( | ||
() => { | ||
const stdout: Buffer = execSync( | ||
`php ${path.join( | ||
Workspace.rootPath!, | ||
`/../phpf.phar --psr2 --dry-run -o=- ${absPath}` | ||
)}` | ||
); | ||
const phpfmtFormatted: string = stdout.toString(); | ||
assert.equal(doc.getText(), phpfmtFormatted); | ||
}, | ||
e => console.error(e) | ||
) | ||
); | ||
}); | ||
} | ||
|
||
suite('Test format', () => { | ||
test('it formats successfully', () => hasFormat('ugly.php')); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// | ||
// PLEASE DO NOT MODIFY / DELETE UNLESS YOU KNOW WHAT YOU ARE DOING | ||
// | ||
// This file is providing the test runner to use when running extension tests. | ||
// By default the test runner in use is Mocha based. | ||
// | ||
// You can provide your own test runner if you want to override it by exporting | ||
// a function run(testRoot: string, clb: (error:Error) => void) that the extension | ||
// host can call to run the tests. The test runner is expected to use console.log | ||
// to report the results back to the caller. When the tests are finished, return | ||
// a possible error to the callback or null if none. | ||
var testRunner = require('vscode/lib/testrunner'); | ||
|
||
// You can directly control Mocha options by uncommenting the following lines | ||
// See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options for more info | ||
testRunner.configure({ | ||
ui: 'tdd', // the TDD UI is being used in extension.test.ts (suite, test, etc.) | ||
useColors: true, // colored output from test results | ||
timeout: 10000 | ||
}); | ||
|
||
module.exports = testRunner; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
class Ugly{ | ||
private $ugly; | ||
|
||
public function __construct($ugly){ | ||
$this->ugly=$ugly; | ||
} | ||
|
||
public function getUgly() | ||
{ | ||
return $this->ugly; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.