-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathunit_tests_with_php_unit.yaml
116 lines (116 loc) · 6.55 KB
/
unit_tests_with_php_unit.yaml
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
questions:
-
uuid: 1eebf878-8b97-6ca0-a2a3-99d84c92580c
question: "When creating stub is it possible to disable the call to the original class' constructor?"
answers:
- { value: 'Yes with the disableConstruct() method.', correct: false }
- { value: 'Yes with the disableConstructor() method.', correct: false }
- { value: 'Yes with the disableOriginalConstructor() method.', correct: true }
- { value: 'No', correct: false }
- { value: 'Yes with the disableOriginalConstruct() method.', correct: false }
help: 'https://phpunit.de/manual/current/en/test-doubles.html#test-doubles.stubs'
-
uuid: 1eebf878-8b98-6a60-9a71-99d84c92580c
question: "What will be the result of that assertion? $this->assertContainsOnly('string', ['1', '2', 3]);"
answers:
- { value: Failure, correct: true }
- { value: Success, correct: false }
help: 'https://phpunit.de/manual/current/en/appendixes.assertions.html#appendixes.assertions.assertContainsOnly'
-
uuid: 1eebf878-8b98-6c04-a1e2-99d84c92580c
question: 'Which is the method that allows to execute some code before each test defined by a class?'
answers:
- { value: 'protected function setUp()', correct: true }
- { value: 'protected static function setUpBeforeClass()', correct: false }
- { value: 'protected function setUpBeforeClass()', correct: false }
- { value: 'protected static function setUp()', correct: false }
help: 'https://phpunit.de/manual/current/en/fixtures.html#fixtures.more-setup-than-teardown'
-
uuid: 1eebf878-8b9a-6b26-87f0-99d84c92580c
question: 'Which of the following are valid ways in PHPUnit to test the exceptions that occur when executing some PHP code?'
answers:
- { value: 'Add the following PHP call inside the test method: $this->expectException(''Fully\\Qualified\\ExceptionClassName'');', correct: true }
- { value: "You can't test PHP exceptions with PHPUnit.", correct: false }
- { value: 'Wrap the entire test method in a try...catch but without processing the exception in any special way: public function testSomething() { try { // ... } catch(\Exception $e) {} }', correct: false }
help: 'https://phpunit.de/manual/current/en/writing-tests-for-phpunit.html#writing-tests-for-phpunit.exceptions'
-
uuid: 1eebf878-8b9c-6160-8a96-99d84c92580c
question: "What will be the result of that assertion in a PHPUnit test? self::assertSame('2204', 2204);"
answers:
- { value: Failure, correct: true }
- { value: Success, correct: false }
help: 'https://phpunit.de/manual/current/en/appendixes.assertions.html#appendixes.assertions.assertSame'
-
uuid: 1eebf878-8b9e-617c-8f02-99d84c92580c
question: 'Using PHPUnit, which method names are used to share test setup code?'
answers:
- { value: setUp(), correct: true }
- { value: __construct(), correct: false }
- { value: shutdown(), correct: false }
- { value: tearDown(), correct: true }
help: 'https://www.w3resource.com/php/PHPUnit/fixtures.php'
-
uuid: 1eebf878-8b9e-61c2-bcfc-99d84c92580c
question: 'How to disable constructor when mocking an object?'
answers:
- { value: '$this->getMock("My\Class")->disableOriginalConstructor()->getMock()', correct: false }
- { value: '$this->disableOriginalConstructor("My\Class")', correct: false }
- { value: '$this->getMockBuilder("My\Class")->disableOriginalConstructor()->getMock()', correct: true }
- { value: '$this->getMockBuilder("My\Class")->getMock()->disableConstructor()', correct: false }
help: 'https://phpunit.de/manual/6.5/en/test-doubles.html#test-doubles.stubs.examples.StubTest2.php'
-
uuid: 1eebf878-8b9e-6320-adc3-99d84c92580c
question: 'Using PHPUnit, which method allows you to expect an exception to be thrown?'
answers:
- { value: "$this->setExpectedException('MyException')", correct: false }
- { value: "$this->setExceptionExpected('MyException')", correct: false }
- { value: "$this->expectException('MyException')", correct: true }
- { value: "$this->setExpected('MyException')", correct: false }
help: 'https://phpunit.de/manual/6.5/en/writing-tests-for-phpunit.html#writing-tests-for-phpunit.exceptions'
-
uuid: 1eebf878-8b9e-6366-b03b-99d84c92580c
question: 'What command used for run all of your application tests by default?'
answers:
- { value: 'phpunit -c app/', correct: false }
- { value: 'phpunit app/', correct: false }
- { value: 'phpunit -c', correct: false }
- { value: phpunit, correct: true }
help: 'https://symfony.com/doc/current/testing.html#unit-tests'
-
uuid: 1eebf878-8b9e-6438-933b-99d84c92580c
question: 'Where live functional tests in Symfony (inside a project structure)?'
answers:
- { value: Tests/, correct: false }
- { value: Tests/Controller/, correct: true }
- { value: Tests/Functional/, correct: false }
- { value: Tests/Functional/Controller, correct: false }
- { value: Tests/Functional/Controllers, correct: false }
- { value: Tests/Controllers/, correct: false }
- { value: Controller/, correct: false }
help: 'https://symfony.com/doc/current/testing.html#integration-tests'
-
uuid: 1eebf878-8ba3-6c12-a0f5-99d84c92580c
question: 'Which of the following assertions is correct?'
answers:
- { value: 'PHP is a loosely-typed imperative language.', correct: true }
- { value: 'PHP is a loosely-typed declarative language.', correct: false }
- { value: 'PHP is a strongly-typed, functionnal language.', correct: false }
- { value: 'PHP is a loosely-typed functionnal language.', correct: false }
help: 'https://en.wikipedia.org/wiki/Programming_paradigm'
-
uuid: 1ef54fc7-3ffd-6b96-9593-233ee6a4489d
question: 'Using PHPUnit, which method names are used to share test setup code?'
answers:
- { value: setUp(), correct: true }
- { value: __construct(), correct: false }
- { value: shutdown(), correct: false }
- { value: tearDown(), correct: true }
help: 'https://docs.phpunit.de/en/10.5/writing-tests-for-phpunit.html'
-
uuid: 1ef81710-a76e-69ac-971a-b11b5f8fed4a
question: 'Which method is provided by the PHPUnit Bridge to assert that a specific deprecation is triggered in your tests?'
answers:
- { value: 'assertDeprecation()', correct: false }
- { value: 'expectDeprecation()', correct: true }
- { value: 'triggerDeprecation()', correct: false }
help: 'https://symfony.com/doc/7.0/components/phpunit_bridge.html#write-assertions-about-deprecations'