Skip to content

Commit

Permalink
add OrgBuilderTest
Browse files Browse the repository at this point in the history
  • Loading branch information
SparkLee committed Feb 23, 2023
1 parent c47a394 commit cbb604a
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/Unit/Domain/OrgMng/Org/OrgBuilderTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace Tests\Unit\Domain\OrgMng\Org;

use App\Domain\Common\Exceptions\BusinessException;
use App\Domain\OrgMng\Org\DTO\OrgDomainDTO;
use App\Domain\OrgMng\Org\OrgBuilder;
use PHPUnit\Framework\TestCase;

class OrgBuilderTest extends TestCase
{
public function test_org_name_should_not_empty()
{
$this->expectException(BusinessException::class);
$this->expectExceptionMessage('组织名不能为空');

$orgDomainDTO = (new OrgDomainDTO())
->tenantId(1)
->superiorId(1)
->orgTypeCode('foo')
->name('');

/** @var OrgBuilder $orgBuilder */
$orgBuilder = app(OrgBuilder::class);

return $orgBuilder
->orgDomainDTO($orgDomainDTO)
->build();
}

}

0 comments on commit cbb604a

Please sign in to comment.