Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task association of Position test and minor fixes to Windowing system concept exercise #604

Merged
merged 6 commits into from Jan 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 2 additions & 4 deletions concepts/class-basics/introduction.md
Expand Up @@ -23,7 +23,7 @@ class Door

Classes are instantiated with the `new` keyword, this allocates memory for the class instance and calls the classes constructor method.
Instantiated classes may be assigned to a variable.
To invoke the methods of a class instance, we can use the `->` access operator
To invoke the methods of a class instance, we can use the `->` access operator.

```php
<?php
Expand All @@ -49,7 +49,7 @@ class Car
$this->color = $color;
}

function getColor(): string
function getColor()
{
return $this->color;
}
Expand All @@ -59,5 +59,3 @@ $a_car = new Car("red");
$a_car->color; // => "red" by accessing the property
$a_car->getColor(); // => "red" by invoking the instance method
```


3 changes: 2 additions & 1 deletion exercises/concept/windowing-system/.docs/hints.md
Expand Up @@ -3,11 +3,12 @@
## General

- Revisit the [Objects Concept][concept-class-basics] if needed to fresh up on the basics.
- Carefully read the instructions for the parameter positioning of `x`, `y`, `width`, and `height`. These are easily confused.

## 1. Define a ProgramWindow class

- Remember to use [class syntax][php-class] for this task.
- Define [properties][php-properties] by adding them to class declaration.
- Define [properties][php-properties] by adding them to the class declaration.

## 2. Define a constructor function for the ProgramWindow class

Expand Down
2 changes: 1 addition & 1 deletion exercises/concept/windowing-system/.docs/instructions.md
Expand Up @@ -4,7 +4,7 @@ In this exercise, you will be simulating a windowing based computer system.
You will create some windows that can be moved and resized.
The following image is representative of the values you will be working with below.

```
```text
╔════════════════════════════════════════════════════════════╗
║ ║
║ position::$x,_ ║
Expand Down
4 changes: 2 additions & 2 deletions exercises/concept/windowing-system/.docs/introduction.md
Expand Up @@ -25,7 +25,7 @@ class Door

Classes are instantiated with the `new` keyword, this allocates memory for the class instance and calls the classes constructor method.
Instantiated classes may be assigned to a variable.
To invoke the methods of a class instance, we can use the `->` access operator
To invoke the methods of a class instance, we can use the `->` access operator.

```php
<?php
Expand All @@ -51,7 +51,7 @@ class Car
$this->color = $color;
}

function getColor(): string
function getColor()
{
return $this->color;
}
Expand Down
22 changes: 11 additions & 11 deletions exercises/concept/windowing-system/ProgramWindowTest.php
Expand Up @@ -74,17 +74,6 @@ public function testHasConstructorSettingInitialValues()
$this->assertEquals(800, $window->width);
}

/**
* @testdox assert Position class exists, with constructor, properties
* @task_id 3
*/
public function testPositionHasConstructorSettingInitialValues()
{
$position = new Position(30, 70);
$this->assertEquals(30, $position->y);
$this->assertEquals(70, $position->x);
}

/**
* @testdox assert Position class exists, with constructor, properties
* @task_id 3
Expand All @@ -109,6 +98,17 @@ public function testProgramWindowResize()
$this->assertEquals(2135, $window->width);
}

/**
* @testdox assert Position class exists, with constructor, properties
* @task_id 4
*/
public function testPositionHasConstructorSettingInitialValues()
{
$position = new Position(30, 70);
$this->assertEquals(30, $position->y);
$this->assertEquals(70, $position->x);
}

/**
* @testdox assert ProgramWindow::move function exists
* @task_id 4
Expand Down