Skip to content

Commit

Permalink
fix(counter): remove static
Browse files Browse the repository at this point in the history
  • Loading branch information
thepercival committed May 26, 2024
1 parent 1a2039f commit 702ddd0
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 67 deletions.
32 changes: 0 additions & 32 deletions domain/Counter.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,38 +16,6 @@ public function __construct(protected mixed $countedObject, protected int $count
{
}

/**
* @return self<T>
*/
public function reset2(): self
{
return new self($this->countedObject);
}

/**
* @return self<T>
*/
public function decrement(): self
{
return new self($this->countedObject, $this->count - 1 );
}

/**
* @return self<T>
*/
public function increment(): self
{
return new self($this->countedObject, $this->count + 1 );
}

/**
* @return self<T>
*/
public function increase(int $count): self
{
return new self($this->countedObject, $this->count + $count );
}

public function count(): int
{
return $this->count;
Expand Down
35 changes: 0 additions & 35 deletions tests/cases/CounterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,39 +17,4 @@ public function testBaiscs(): void
$counter = new Counter($stdClass, 5);
self::assertSame(5, $counter->count());
}

public function testReset(): void
{
$stdClass = new \stdClass();

$counter = new Counter($stdClass, 4);
$counter->reset2();
self::assertSame(0, $counter->count());
}

public function testDecrement(): void
{
$stdClass = new \stdClass();

$counter = new Counter($stdClass);
self::assertSame(-1, $counter->decrement()->count());

$counter = new Counter($stdClass, 4);
self::assertSame(3, $counter->decrement()->count());
}

public function testIncrement(): void
{
$stdClass = new \stdClass();
$counter = new Counter($stdClass, 4);
self::assertSame(5, $counter->increment());
}

public function testIncrease(): void
{
$stdClass = new \stdClass();
$counter = new Counter($stdClass, 4);
$counter->increase(3);
self::assertSame(7, $counter->count());
}
}

0 comments on commit 702ddd0

Please sign in to comment.